結果
| 問題 |
No.2509 Beam Shateki
|
| コンテスト | |
| ユーザー |
yupooh
|
| 提出日時 | 2023-10-20 21:54:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 996 bytes |
| コンパイル時間 | 475 ms |
| コンパイル使用メモリ | 81,756 KB |
| 実行使用メモリ | 78,136 KB |
| 最終ジャッジ日時 | 2024-09-20 18:42:15 |
| 合計ジャッジ時間 | 55,249 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 60 TLE * 1 |
ソースコード
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),(-1,0),(-1,1),(0,-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