-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path14500.py
23 lines (23 loc) · 1021 Bytes
/
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
import sys
input=lambda:sys.stdin.readline().rstrip()
N,M=map(int,input().split())
graph=[list(map(int,input().split())) for _ in range(N)]
m=0
t=[[(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),(0,1),(0,2),(1,0)],[(0,0),(0,1),(0,2),(-1,0)],[(0,0),(1,0),(2,0),(0,1)],[(0,0),(1,0),(2,0),(0,-1)]
,[(0,0),(0,1),(0,2),(1,2)],[(0,0),(0,1),(0,2),(-1,2)],[(0,0),(1,0),(2,0),(2,1)],[(0,0),(1,0),(2,0),(2,-1)]
,[(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)]#ㅗ
,[(0,0),(0,1),(-1,1),(1,0)],[(0,0),(0,1),(1,1),(-1,0)],[(0,0),(1,0),(1,1),(0,-1)],[(0,0),(1,0),(1,-1),(0,1)]]
for j in range(N):
for i in range(M):
for k in t:
s=0
for x,y in k:
if 0<=i+x<M and 0<=j+y<N:
s+=graph[j+y][i+x]
else:
s=0
break
m=max(m,s)
print(m)