結果
問題 |
No.2509 Beam Shateki
|
ユーザー |
|
提出日時 | 2023-10-20 21:51:12 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,110 bytes |
コンパイル時間 | 484 ms |
コンパイル使用メモリ | 82,444 KB |
実行使用メモリ | 85,168 KB |
最終ジャッジ日時 | 2024-09-20 18:23:14 |
合計ジャッジ時間 | 19,920 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 TLE * 1 -- * 50 |
ソースコード
import sys input = sys.stdin.readline h,w = map(int,input().split()) grid = [] for i in range(h): grid.append(list(map(int,input().split()))) ans = 0 dxy = [[-1,-1],[-1,0],[-1,1],[0,-1],[0,1],[1,-1],[1,0],[1,1]] s = set() for i in [0,h]: for j in range(w+2): s.add((i,j)) for i in [0,w]: for j in range(h+2): s.add((j,i)) for x,y in s: for dx,dy in dxy: temp = 1 cnt = 0 se = set() while 1 <= x+dx*temp <= h and 1 <= y+dy*temp <= w: cnt += grid[x+dx*temp-1][y+dy*temp-1] se.add((x+dx*temp-1,y+dy*temp-1)) temp += 1 for u,v in s: if x == u and y == v: continue for dx,dy in dxy: c = 0 temp = 1 while 1 <= u+dx*temp <= h and 1 <= v+dy*temp <= w: if (u+dx*temp-1,v+dy*temp-1) in se: temp += 1 continue c += grid[u+dx*temp-1][v+dy*temp-1] temp += 1 ans = max(ans,cnt+c) print(ans)