結果

問題 No.2509 Beam Shateki
ユーザー yupoohyupooh
提出日時 2023-10-20 21:57:51
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 976 bytes
コンパイル時間 807 ms
コンパイル使用メモリ 81,772 KB
実行使用メモリ 77,344 KB
最終ジャッジ日時 2023-10-20 21:59:13
合計ジャッジ時間 61,742 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
61,792 KB
testcase_01 AC 43 ms
61,652 KB
testcase_02 AC 34 ms
53,392 KB
testcase_03 AC 343 ms
75,952 KB
testcase_04 AC 347 ms
75,952 KB
testcase_05 AC 365 ms
75,948 KB
testcase_06 AC 344 ms
75,952 KB
testcase_07 AC 336 ms
75,952 KB
testcase_08 AC 353 ms
75,952 KB
testcase_09 AC 342 ms
75,948 KB
testcase_10 AC 342 ms
75,952 KB
testcase_11 AC 338 ms
75,948 KB
testcase_12 AC 365 ms
75,952 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 132 ms
75,724 KB
testcase_34 AC 538 ms
76,084 KB
testcase_35 AC 1,053 ms
76,220 KB
testcase_36 AC 276 ms
75,960 KB
testcase_37 AC 102 ms
75,652 KB
testcase_38 AC 304 ms
76,044 KB
testcase_39 AC 274 ms
75,920 KB
testcase_40 AC 641 ms
76,152 KB
testcase_41 AC 90 ms
75,388 KB
testcase_42 AC 343 ms
75,948 KB
testcase_43 AC 1,278 ms
76,476 KB
testcase_44 AC 1,546 ms
76,520 KB
testcase_45 AC 252 ms
76,000 KB
testcase_46 AC 418 ms
76,056 KB
testcase_47 AC 1,505 ms
76,544 KB
testcase_48 AC 451 ms
76,012 KB
testcase_49 AC 745 ms
76,024 KB
testcase_50 AC 892 ms
76,340 KB
testcase_51 AC 122 ms
75,648 KB
testcase_52 AC 590 ms
75,976 KB
testcase_53 AC 55 ms
66,132 KB
testcase_54 AC 55 ms
66,132 KB
testcase_55 AC 59 ms
68,200 KB
testcase_56 AC 59 ms
68,200 KB
testcase_57 AC 58 ms
68,200 KB
testcase_58 AC 59 ms
68,200 KB
testcase_59 AC 58 ms
68,200 KB
testcase_60 AC 58 ms
68,200 KB
testcase_61 AC 60 ms
68,200 KB
testcase_62 AC 59 ms
68,200 KB
testcase_63 AC 59 ms
68,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0