結果

問題 No.2509 Beam Shateki
ユーザー hirayuu_ychirayuu_yc
提出日時 2023-10-20 21:39:02
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,585 bytes
コンパイル時間 154 ms
コンパイル使用メモリ 81,816 KB
実行使用メモリ 86,444 KB
最終ジャッジ日時 2023-10-20 21:39:29
合計ジャッジ時間 26,705 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
55,680 KB
testcase_01 AC 47 ms
55,680 KB
testcase_02 AC 42 ms
55,680 KB
testcase_03 AC 228 ms
77,848 KB
testcase_04 AC 219 ms
77,900 KB
testcase_05 AC 229 ms
77,888 KB
testcase_06 AC 217 ms
77,852 KB
testcase_07 AC 218 ms
77,900 KB
testcase_08 AC 213 ms
77,888 KB
testcase_09 AC 219 ms
77,904 KB
testcase_10 AC 219 ms
77,888 KB
testcase_11 AC 213 ms
77,896 KB
testcase_12 AC 214 ms
77,896 KB
testcase_13 AC 806 ms
86,072 KB
testcase_14 AC 789 ms
86,076 KB
testcase_15 AC 805 ms
86,080 KB
testcase_16 AC 796 ms
86,444 KB
testcase_17 AC 774 ms
85,920 KB
testcase_18 AC 776 ms
86,080 KB
testcase_19 AC 820 ms
86,036 KB
testcase_20 AC 794 ms
86,084 KB
testcase_21 AC 835 ms
86,100 KB
testcase_22 AC 780 ms
86,032 KB
testcase_23 AC 830 ms
86,076 KB
testcase_24 AC 771 ms
86,088 KB
testcase_25 AC 774 ms
86,008 KB
testcase_26 AC 829 ms
86,088 KB
testcase_27 AC 774 ms
86,008 KB
testcase_28 AC 830 ms
85,988 KB
testcase_29 AC 776 ms
86,044 KB
testcase_30 AC 823 ms
86,104 KB
testcase_31 WA -
testcase_32 AC 773 ms
86,112 KB
testcase_33 AC 110 ms
76,556 KB
testcase_34 AC 273 ms
77,884 KB
testcase_35 AC 463 ms
81,012 KB
testcase_36 AC 183 ms
77,520 KB
testcase_37 AC 99 ms
77,096 KB
testcase_38 AC 190 ms
77,584 KB
testcase_39 AC 206 ms
78,124 KB
testcase_40 AC 318 ms
79,464 KB
testcase_41 AC 76 ms
72,872 KB
testcase_42 AC 220 ms
77,500 KB
testcase_43 AC 550 ms
81,512 KB
testcase_44 AC 610 ms
83,588 KB
testcase_45 AC 180 ms
77,548 KB
testcase_46 AC 233 ms
77,716 KB
testcase_47 AC 623 ms
82,164 KB
testcase_48 AC 249 ms
78,232 KB
testcase_49 AC 355 ms
78,476 KB
testcase_50 AC 391 ms
79,584 KB
testcase_51 AC 120 ms
76,732 KB
testcase_52 AC 302 ms
78,492 KB
testcase_53 AC 45 ms
55,680 KB
testcase_54 AC 45 ms
55,680 KB
testcase_55 AC 51 ms
61,524 KB
testcase_56 AC 59 ms
61,524 KB
testcase_57 AC 54 ms
61,524 KB
testcase_58 WA -
testcase_59 AC 51 ms
61,524 KB
testcase_60 WA -
testcase_61 AC 51 ms
61,524 KB
testcase_62 WA -
testcase_63 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from copy import deepcopy
deg=[(0,1),(1,0),(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)
0