結果
問題 | No.2509 Beam Shateki |
ユーザー | hirayuu_yc |
提出日時 | 2023-10-20 21:40:31 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,600 bytes |
コンパイル時間 | 200 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 88,688 KB |
最終ジャッジ日時 | 2024-09-20 17:48:13 |
合計ジャッジ時間 | 30,416 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 44 ms
54,784 KB |
testcase_01 | AC | 44 ms
54,656 KB |
testcase_02 | AC | 42 ms
53,760 KB |
testcase_03 | AC | 246 ms
78,140 KB |
testcase_04 | AC | 240 ms
78,184 KB |
testcase_05 | AC | 240 ms
78,060 KB |
testcase_06 | AC | 234 ms
78,056 KB |
testcase_07 | AC | 237 ms
78,140 KB |
testcase_08 | AC | 243 ms
78,060 KB |
testcase_09 | AC | 249 ms
78,024 KB |
testcase_10 | AC | 262 ms
78,004 KB |
testcase_11 | AC | 258 ms
78,148 KB |
testcase_12 | AC | 260 ms
78,188 KB |
testcase_13 | AC | 917 ms
88,064 KB |
testcase_14 | AC | 923 ms
88,448 KB |
testcase_15 | AC | 953 ms
88,192 KB |
testcase_16 | AC | 975 ms
88,236 KB |
testcase_17 | AC | 936 ms
88,192 KB |
testcase_18 | AC | 908 ms
88,176 KB |
testcase_19 | AC | 927 ms
88,156 KB |
testcase_20 | AC | 953 ms
88,192 KB |
testcase_21 | AC | 916 ms
88,192 KB |
testcase_22 | AC | 927 ms
88,144 KB |
testcase_23 | AC | 969 ms
88,188 KB |
testcase_24 | AC | 967 ms
88,064 KB |
testcase_25 | AC | 927 ms
88,016 KB |
testcase_26 | AC | 1,010 ms
88,688 KB |
testcase_27 | AC | 969 ms
88,192 KB |
testcase_28 | AC | 963 ms
87,924 KB |
testcase_29 | AC | 918 ms
88,076 KB |
testcase_30 | AC | 914 ms
88,192 KB |
testcase_31 | WA | - |
testcase_32 | AC | 911 ms
88,064 KB |
testcase_33 | AC | 120 ms
77,116 KB |
testcase_34 | AC | 321 ms
78,692 KB |
testcase_35 | AC | 554 ms
81,536 KB |
testcase_36 | AC | 210 ms
77,804 KB |
testcase_37 | AC | 113 ms
76,936 KB |
testcase_38 | AC | 235 ms
78,000 KB |
testcase_39 | AC | 214 ms
78,792 KB |
testcase_40 | AC | 380 ms
79,840 KB |
testcase_41 | AC | 102 ms
77,064 KB |
testcase_42 | AC | 245 ms
78,268 KB |
testcase_43 | AC | 606 ms
83,328 KB |
testcase_44 | AC | 690 ms
84,224 KB |
testcase_45 | AC | 193 ms
78,324 KB |
testcase_46 | AC | 242 ms
78,064 KB |
testcase_47 | AC | 698 ms
83,968 KB |
testcase_48 | AC | 284 ms
78,176 KB |
testcase_49 | AC | 417 ms
78,964 KB |
testcase_50 | AC | 506 ms
80,784 KB |
testcase_51 | AC | 123 ms
77,136 KB |
testcase_52 | AC | 332 ms
78,684 KB |
testcase_53 | AC | 51 ms
61,184 KB |
testcase_54 | AC | 50 ms
61,056 KB |
testcase_55 | AC | 55 ms
63,232 KB |
testcase_56 | AC | 53 ms
62,720 KB |
testcase_57 | AC | 54 ms
62,464 KB |
testcase_58 | WA | - |
testcase_59 | AC | 53 ms
63,104 KB |
testcase_60 | WA | - |
testcase_61 | AC | 54 ms
62,848 KB |
testcase_62 | WA | - |
testcase_63 | WA | - |
ソースコード
from copy import deepcopy deg=[(0,1),(1,0),(1,1),(-1,1),(1,-1),(-1,-1)] H,W=map(int,input().split()) A=[list(map(int,input().split())) for i in range(H)] beam=[] for i in range(W+1): for xd,yd in deg: x=i y=0 x+=xd y+=yd now=0 while 1<=x<=W and 1<=y<=H: now+=A[y-1][x-1] x+=xd y+=yd if now!=0: beam.append((now,i,0,xd,yd)) for i in range(H+1): for xd,yd in deg: x=0 y=i x+=xd y+=yd now=0 while 1<=x<=W and 1<=y<=H: now+=A[y-1][x-1] x+=xd y+=yd if now!=0: beam.append((now,0,i,xd,yd)) ap=deepcopy(A) beam.sort(reverse=True) ans1=0 for p in range(len(beam)): A=deepcopy(ap) x=beam[p][1] y=beam[p][2] xd=beam[p][3] yd=beam[p][4] x+=xd y+=yd ans=beam[p][0] while 1<=x<=W and 1<=y<=H: A[y-1][x-1]=0 x+=xd y+=yd maxi=0 for i in range(W+1): for xd,yd in deg: x=i y=0 x+=xd y+=yd now=0 while 1<=x<=W and 1<=y<=H: now+=A[y-1][x-1] x+=xd y+=yd maxi=max(maxi,now) for i in range(H+1): for xd,yd in deg: x=0 y=i x+=xd y+=yd now=0 while 1<=x<=W and 1<=y<=H: now+=A[y-1][x-1] x+=xd y+=yd maxi=max(maxi,now) ans1=max(ans1,ans+maxi) print(ans1)