結果
問題 | No.2509 Beam Shateki |
ユーザー |
![]() |
提出日時 | 2023-10-20 23:14:33 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 718 bytes |
コンパイル時間 | 607 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 16,640 KB |
最終ジャッジ日時 | 2024-09-20 22:36:33 |
合計ジャッジ時間 | 4,970 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 57 WA * 4 |
ソースコード
h,w = map(int,input().split())a = [[0]*(w+3)]+[[0]+list(map(int,input().split()))+[0,0] for _ in range(h)]+[[0]*(w+3),[0]*(w+3)]s = []; ans = 0for x in range(h+2):for dx in range(-1,2):px = x+dx; py = 1; t = set(); u = 0while a[px][py]: t.add((px,py)); u += a[px][py]; px += dx; py += 1s.append((u,t))for y in range(w+2):for dy in range(-1,2):px = 1; py = y+dy; t = set(); u = 0while a[px][py]: t.add((px,py)); u += a[px][py]; px += 1; py += dys.append((u,t))s.sort(reverse=True)for i in range(len(s)-1):for j in range(i+1,len(s)):if s[i][0]+s[j][0]<ans: breakans = max(ans,sum(a[x][y] for x,y in s[i][1]|s[j][1]))print(ans)