結果

問題 No.2509 Beam Shateki
ユーザー yupoohyupooh
提出日時 2023-10-20 21:54:09
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 996 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 81,816 KB
実行使用メモリ 77,340 KB
最終ジャッジ日時 2023-10-20 21:56:08
合計ジャッジ時間 64,167 ms
ジャッジサーバーID
(参考情報)
judge14 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 55 ms
66,280 KB
testcase_01 AC 49 ms
62,020 KB
testcase_02 AC 41 ms
53,544 KB
testcase_03 AC 399 ms
76,360 KB
testcase_04 AC 373 ms
76,360 KB
testcase_05 AC 383 ms
76,360 KB
testcase_06 AC 398 ms
76,360 KB
testcase_07 AC 374 ms
76,360 KB
testcase_08 AC 372 ms
76,360 KB
testcase_09 AC 385 ms
76,356 KB
testcase_10 AC 374 ms
76,360 KB
testcase_11 AC 380 ms
76,356 KB
testcase_12 AC 385 ms
76,360 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 149 ms
75,948 KB
testcase_34 AC 605 ms
76,764 KB
testcase_35 AC 1,126 ms
76,840 KB
testcase_36 AC 311 ms
76,184 KB
testcase_37 AC 114 ms
75,812 KB
testcase_38 AC 331 ms
76,260 KB
testcase_39 AC 291 ms
76,132 KB
testcase_40 AC 683 ms
76,896 KB
testcase_41 AC 89 ms
75,812 KB
testcase_42 AC 377 ms
76,312 KB
testcase_43 AC 1,328 ms
76,552 KB
testcase_44 AC 1,634 ms
76,748 KB
testcase_45 AC 279 ms
76,176 KB
testcase_46 AC 428 ms
76,272 KB
testcase_47 AC 1,627 ms
76,932 KB
testcase_48 AC 531 ms
76,432 KB
testcase_49 AC 764 ms
76,884 KB
testcase_50 AC 905 ms
76,604 KB
testcase_51 AC 138 ms
75,832 KB
testcase_52 AC 656 ms
76,740 KB
testcase_53 AC 63 ms
68,376 KB
testcase_54 AC 61 ms
68,376 KB
testcase_55 AC 64 ms
70,448 KB
testcase_56 AC 66 ms
70,448 KB
testcase_57 AC 64 ms
70,448 KB
testcase_58 AC 65 ms
70,448 KB
testcase_59 AC 70 ms
70,448 KB
testcase_60 AC 69 ms
70,448 KB
testcase_61 AC 69 ms
70,448 KB
testcase_62 AC 65 ms
70,448 KB
testcase_63 AC 65 ms
70,448 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),(-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)
0