結果

問題 No.2509 Beam Shateki
ユーザー hirayuu_ychirayuu_yc
提出日時 2023-10-20 21:42:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,600 bytes
コンパイル時間 162 ms
コンパイル使用メモリ 81,784 KB
実行使用メモリ 87,876 KB
最終ジャッジ日時 2023-10-20 21:43:49
合計ジャッジ時間 30,616 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
55,492 KB
testcase_01 AC 39 ms
55,492 KB
testcase_02 AC 39 ms
55,492 KB
testcase_03 AC 237 ms
77,548 KB
testcase_04 AC 223 ms
77,552 KB
testcase_05 AC 222 ms
77,544 KB
testcase_06 AC 221 ms
77,540 KB
testcase_07 AC 221 ms
77,552 KB
testcase_08 AC 228 ms
77,544 KB
testcase_09 AC 231 ms
77,556 KB
testcase_10 AC 226 ms
77,544 KB
testcase_11 AC 227 ms
77,556 KB
testcase_12 AC 236 ms
77,644 KB
testcase_13 AC 870 ms
87,872 KB
testcase_14 AC 886 ms
87,864 KB
testcase_15 AC 855 ms
87,700 KB
testcase_16 AC 856 ms
87,800 KB
testcase_17 AC 888 ms
87,612 KB
testcase_18 AC 852 ms
87,640 KB
testcase_19 AC 864 ms
87,708 KB
testcase_20 AC 857 ms
87,644 KB
testcase_21 AC 876 ms
87,712 KB
testcase_22 AC 857 ms
87,508 KB
testcase_23 AC 879 ms
87,596 KB
testcase_24 AC 885 ms
87,744 KB
testcase_25 AC 857 ms
87,700 KB
testcase_26 AC 893 ms
87,876 KB
testcase_27 AC 857 ms
87,804 KB
testcase_28 AC 891 ms
87,604 KB
testcase_29 AC 863 ms
87,800 KB
testcase_30 AC 902 ms
87,708 KB
testcase_31 WA -
testcase_32 AC 883 ms
87,804 KB
testcase_33 AC 111 ms
76,516 KB
testcase_34 AC 290 ms
78,052 KB
testcase_35 AC 490 ms
80,904 KB
testcase_36 AC 174 ms
77,300 KB
testcase_37 AC 97 ms
76,472 KB
testcase_38 AC 193 ms
77,472 KB
testcase_39 AC 175 ms
78,052 KB
testcase_40 AC 359 ms
78,660 KB
testcase_41 AC 83 ms
76,560 KB
testcase_42 AC 210 ms
77,280 KB
testcase_43 AC 567 ms
82,480 KB
testcase_44 AC 659 ms
83,560 KB
testcase_45 AC 182 ms
77,572 KB
testcase_46 AC 253 ms
77,564 KB
testcase_47 AC 711 ms
83,484 KB
testcase_48 AC 266 ms
77,624 KB
testcase_49 AC 414 ms
78,548 KB
testcase_50 AC 472 ms
80,604 KB
testcase_51 AC 127 ms
76,816 KB
testcase_52 AC 343 ms
78,200 KB
testcase_53 AC 53 ms
61,548 KB
testcase_54 AC 56 ms
61,548 KB
testcase_55 AC 57 ms
63,736 KB
testcase_56 AC 57 ms
63,736 KB
testcase_57 AC 56 ms
63,736 KB
testcase_58 WA -
testcase_59 AC 57 ms
63,736 KB
testcase_60 WA -
testcase_61 AC 72 ms
63,736 KB
testcase_62 AC 57 ms
63,736 KB
testcase_63 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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+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
        if now!=0:
            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
        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)
0