結果

問題 No.2509 Beam Shateki
ユーザー hirayuu_ychirayuu_yc
提出日時 2023-10-20 21:31:34
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,323 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 66,528 KB
最終ジャッジ日時 2023-10-20 21:32:11
合計ジャッジ時間 4,926 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,452 KB
testcase_01 AC 36 ms
53,452 KB
testcase_02 AC 34 ms
53,452 KB
testcase_03 WA -
testcase_04 AC 65 ms
66,360 KB
testcase_05 AC 53 ms
66,360 KB
testcase_06 AC 62 ms
66,360 KB
testcase_07 AC 62 ms
66,360 KB
testcase_08 AC 55 ms
66,360 KB
testcase_09 AC 53 ms
66,360 KB
testcase_10 AC 53 ms
66,360 KB
testcase_11 AC 55 ms
66,360 KB
testcase_12 AC 54 ms
66,360 KB
testcase_13 WA -
testcase_14 AC 53 ms
66,160 KB
testcase_15 AC 54 ms
66,160 KB
testcase_16 AC 54 ms
66,160 KB
testcase_17 AC 54 ms
66,160 KB
testcase_18 AC 54 ms
66,160 KB
testcase_19 AC 53 ms
66,160 KB
testcase_20 AC 58 ms
66,160 KB
testcase_21 AC 54 ms
66,160 KB
testcase_22 AC 61 ms
66,160 KB
testcase_23 AC 53 ms
66,160 KB
testcase_24 AC 57 ms
66,160 KB
testcase_25 AC 52 ms
66,160 KB
testcase_26 AC 54 ms
66,160 KB
testcase_27 AC 54 ms
66,160 KB
testcase_28 AC 53 ms
66,160 KB
testcase_29 AC 54 ms
66,160 KB
testcase_30 AC 56 ms
66,160 KB
testcase_31 WA -
testcase_32 AC 61 ms
66,160 KB
testcase_33 AC 47 ms
61,460 KB
testcase_34 AC 52 ms
64,112 KB
testcase_35 AC 58 ms
64,112 KB
testcase_36 AC 49 ms
64,112 KB
testcase_37 AC 37 ms
53,452 KB
testcase_38 AC 54 ms
64,112 KB
testcase_39 AC 50 ms
64,112 KB
testcase_40 AC 54 ms
64,112 KB
testcase_41 AC 39 ms
53,452 KB
testcase_42 AC 52 ms
64,112 KB
testcase_43 AC 56 ms
64,112 KB
testcase_44 AC 54 ms
66,160 KB
testcase_45 AC 50 ms
64,112 KB
testcase_46 AC 52 ms
64,112 KB
testcase_47 AC 54 ms
66,160 KB
testcase_48 AC 51 ms
64,112 KB
testcase_49 AC 55 ms
64,112 KB
testcase_50 AC 54 ms
64,112 KB
testcase_51 AC 43 ms
59,412 KB
testcase_52 AC 52 ms
64,112 KB
testcase_53 AC 34 ms
53,452 KB
testcase_54 AC 37 ms
53,452 KB
testcase_55 AC 37 ms
53,452 KB
testcase_56 AC 36 ms
53,452 KB
testcase_57 AC 37 ms
53,452 KB
testcase_58 WA -
testcase_59 AC 38 ms
53,452 KB
testcase_60 WA -
testcase_61 AC 36 ms
53,452 KB
testcase_62 WA -
testcase_63 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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))
beam.sort(reverse=True)
x=beam[0][1]
y=beam[0][2]
xd=beam[0][3]
yd=beam[0][4]
x+=xd
y+=yd
ans=beam[0][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)
print(ans+maxi)
0