-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path14500.py
32 lines (31 loc) · 1.05 KB
/
14500.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
pattern = [[[0,0],[0,1],[0,2],[0,3]],
[[0,0],[1,0],[2,0],[3,0]],
[[0,0],[0,1],[1,0],[1,1]],
[[0,0],[1,0],[2,0],[2,1]],
[[0,0],[0,1],[0,2],[-1,2]],
[[-1,0],[0,0],[0,1],[0,2]],
[[0,0],[0,1],[-1,1],[-2,1]],
[[0,0],[0,1],[0,2],[1,2]],
[[0,0],[1,0],[0,1],[0,2]],
[[0,0],[1,0],[2,0],[0,1]],
[[0,0],[1,0],[1,1],[2,1]],
[[0,0],[0,1],[1,1],[1,2]],
[[0,0],[0,1],[1,1],[2,1]],
[[0,0],[1,0],[1,-1],[2,-1]],
[[0,0],[0,1],[-1,1],[-1,2]],
[[0,0],[0,1],[0,2],[-1,1]],
[[0,0],[0,1],[0,2],[1,1]],
[[0,0],[1,0],[2,0],[1,1]],
[[0,0],[1,0],[2,0],[1,-1]]]
n,m = map(int,input().split())
paper = [list(map(int,input().split())) for _ in range(n)]
answer = 0
for p in pattern:
for i in range(n):
for j in range(m):
sum = 0
for t in range(4):
try: sum += paper[i+p[t][0]][j+p[t][1]]
except: continue
answer = max(answer,sum)
print(answer)