結果
| 問題 |
No.2509 Beam Shateki
|
| コンテスト | |
| ユーザー |
yupooh
|
| 提出日時 | 2023-10-20 21:57:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,990 ms / 2,000 ms |
| コード長 | 976 bytes |
| コンパイル時間 | 221 ms |
| コンパイル使用メモリ | 82,232 KB |
| 実行使用メモリ | 78,064 KB |
| 最終ジャッジ日時 | 2024-09-20 18:51:45 |
| 合計ジャッジ時間 | 55,656 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 61 |
ソースコード
import sys
input = sys.stdin.readline
h,w=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(h)]
d=[(-1,-1),(0,-1),(1,-1),(1,0),(1,1)]
ans=0
l=[]
for i in range(w+1):
l.append((0,i))
for i in range(h+1):
l.append((i,w+1))
for i,j in l:
for ii,jj in l:
for dx,dy in d:
for ddx,ddy in d:
se=set()
if not(1<=i+dx<=h) or not(1<=j+dy<=w) or not(1<=ii+ddx<=h) or not(1<=jj+ddy<=w):
continue
nowi=i+dx
nowj=j+dy
tmp=0
cnt=0
while 1<=nowi<=h and 1<=nowj<=w:
cnt+=1
tmp+=A[nowi-1][nowj-1]
se.add(nowi*200+nowj)
nowi+=dx
nowj+=dy
if cnt==0:
continue
nowi=ii+ddx
nowj=jj+ddy
while 1<=nowi<=h and 1<=nowj<=w:
if nowi*200+nowj not in se:
tmp+=A[nowi-1][nowj-1]
se.add(nowi*200+nowj)
nowi+=ddx
nowj+=ddy
ans=max(ans,tmp)
print(ans)
yupooh