結果

問題 No.2509 Beam Shateki
ユーザー hirayuu_ychirayuu_yc
提出日時 2023-10-20 21:48:14
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,568 bytes
コンパイル時間 215 ms
コンパイル使用メモリ 81,848 KB
実行使用メモリ 105,660 KB
最終ジャッジ日時 2023-10-20 21:50:07
合計ジャッジ時間 13,327 ms
ジャッジサーバーID
(参考情報)
judge15 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
75,156 KB
testcase_01 AC 65 ms
68,396 KB
testcase_02 AC 59 ms
61,924 KB
testcase_03 AC 448 ms
78,624 KB
testcase_04 AC 446 ms
78,624 KB
testcase_05 AC 448 ms
78,596 KB
testcase_06 AC 474 ms
78,560 KB
testcase_07 AC 447 ms
78,572 KB
testcase_08 AC 442 ms
78,600 KB
testcase_09 AC 433 ms
78,628 KB
testcase_10 AC 440 ms
78,620 KB
testcase_11 AC 441 ms
78,624 KB
testcase_12 AC 440 ms
78,532 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 172 ms
78,028 KB
testcase_34 AC 665 ms
80,544 KB
testcase_35 AC 1,234 ms
87,572 KB
testcase_36 AC 338 ms
78,084 KB
testcase_37 AC 128 ms
77,496 KB
testcase_38 AC 384 ms
78,380 KB
testcase_39 AC 322 ms
78,268 KB
testcase_40 AC 776 ms
82,176 KB
testcase_41 AC 109 ms
76,852 KB
testcase_42 AC 437 ms
78,788 KB
testcase_43 AC 1,464 ms
91,420 KB
testcase_44 AC 1,755 ms
94,696 KB
testcase_45 AC 325 ms
77,864 KB
testcase_46 AC 455 ms
78,456 KB
testcase_47 AC 1,766 ms
94,580 KB
testcase_48 AC 577 ms
79,564 KB
testcase_49 AC 876 ms
81,680 KB
testcase_50 AC 1,046 ms
84,964 KB
testcase_51 AC 169 ms
77,432 KB
testcase_52 AC 710 ms
80,528 KB
testcase_53 AC 91 ms
76,468 KB
testcase_54 AC 91 ms
76,468 KB
testcase_55 AC 98 ms
76,712 KB
testcase_56 AC 99 ms
76,684 KB
testcase_57 AC 97 ms
76,620 KB
testcase_58 WA -
testcase_59 AC 99 ms
76,704 KB
testcase_60 WA -
testcase_61 AC 99 ms
76,708 KB
testcase_62 AC 98 ms
76,620 KB
testcase_63 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from copy import deepcopy
deg=[(0,1),(1,0),(1,1),(-1,1),(1,-1),(-1,-1),(-1,0),(0,-1)]
H,W=map(int,input().split())
A=[list(map(int,input().split())) for i in range(H)]
beam=[]
for i in range(W+2):
    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
        beam.append((now,i,0,xd,yd))
for i in range(H+2):
    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
        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+2):
        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+2):
        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)
0