結果

問題 No.2509 Beam Shateki
ユーザー miya145592miya145592
提出日時 2023-10-21 00:31:48
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,317 bytes
コンパイル時間 218 ms
コンパイル使用メモリ 81,808 KB
実行使用メモリ 77,344 KB
最終ジャッジ日時 2023-10-21 00:32:13
合計ジャッジ時間 24,448 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,540 KB
testcase_01 AC 39 ms
53,540 KB
testcase_02 AC 38 ms
53,540 KB
testcase_03 AC 191 ms
76,572 KB
testcase_04 AC 195 ms
76,572 KB
testcase_05 AC 221 ms
76,572 KB
testcase_06 AC 190 ms
76,572 KB
testcase_07 AC 189 ms
76,572 KB
testcase_08 AC 189 ms
76,576 KB
testcase_09 AC 189 ms
76,572 KB
testcase_10 AC 190 ms
76,572 KB
testcase_11 AC 219 ms
76,572 KB
testcase_12 AC 191 ms
76,576 KB
testcase_13 AC 705 ms
76,972 KB
testcase_14 AC 732 ms
77,008 KB
testcase_15 AC 730 ms
76,884 KB
testcase_16 AC 710 ms
76,884 KB
testcase_17 AC 745 ms
76,976 KB
testcase_18 AC 711 ms
76,972 KB
testcase_19 AC 741 ms
76,884 KB
testcase_20 AC 708 ms
76,884 KB
testcase_21 AC 732 ms
76,884 KB
testcase_22 AC 740 ms
76,984 KB
testcase_23 AC 707 ms
76,884 KB
testcase_24 AC 735 ms
76,984 KB
testcase_25 AC 719 ms
76,884 KB
testcase_26 AC 715 ms
76,976 KB
testcase_27 AC 736 ms
76,984 KB
testcase_28 AC 708 ms
76,984 KB
testcase_29 AC 733 ms
76,884 KB
testcase_30 AC 707 ms
76,884 KB
testcase_31 WA -
testcase_32 AC 742 ms
76,976 KB
testcase_33 AC 122 ms
76,684 KB
testcase_34 AC 253 ms
76,576 KB
testcase_35 AC 409 ms
76,520 KB
testcase_36 AC 169 ms
76,644 KB
testcase_37 AC 87 ms
76,000 KB
testcase_38 AC 184 ms
76,496 KB
testcase_39 AC 175 ms
77,136 KB
testcase_40 AC 305 ms
77,344 KB
testcase_41 AC 73 ms
70,488 KB
testcase_42 AC 192 ms
76,356 KB
testcase_43 AC 494 ms
76,644 KB
testcase_44 AC 551 ms
77,248 KB
testcase_45 AC 164 ms
76,520 KB
testcase_46 AC 212 ms
76,424 KB
testcase_47 AC 550 ms
76,548 KB
testcase_48 AC 222 ms
76,376 KB
testcase_49 AC 320 ms
76,572 KB
testcase_50 AC 375 ms
76,596 KB
testcase_51 AC 111 ms
76,004 KB
testcase_52 AC 270 ms
76,596 KB
testcase_53 AC 47 ms
59,788 KB
testcase_54 AC 46 ms
59,788 KB
testcase_55 AC 47 ms
61,828 KB
testcase_56 AC 46 ms
61,828 KB
testcase_57 AC 48 ms
61,828 KB
testcase_58 WA -
testcase_59 AC 47 ms
61,828 KB
testcase_60 WA -
testcase_61 AC 46 ms
61,828 KB
testcase_62 AC 49 ms
61,828 KB
testcase_63 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
H, W = map(int, input().split())
A = [list(map(int, input().split())) for _ in range(H)]
ans = 0
for x in range(H+W+4):
    if 0<=x<=H+1:
        dir = [(0, 1), (1, 1), (-1, 1)]
    else:
        dir = [(1, 0), (1, 1), (1, -1)]
    for dx, dy in dir:
        sco = 0
        S = set()
        if 0<=x<=H+1:
            nx = x
            ny = 0
        else:
            nx = 0
            ny = x-(H+2)
        nx+=dx
        ny+=dy
        while 1<=nx<=H and 1<=ny<=W:
            sco += A[nx-1][ny-1]
            S.add((nx, ny))
            nx+=dx
            ny+=dy

        for x2 in range(x, H+W+4):
            if 0<=x2<=H+1:
                dir2 = [(0, 1), (1, 1), (-1, 1)]
            else:
                dir2 = [(1, 0), (1, 1), (1, -1)]
            for dx2, dy2 in dir2:
                sco2 = 0
                if 0<=x2<=H+1:
                    nx2 = x2
                    ny2 = 0
                else:
                    nx2 = 0
                    ny2 = x2-(H+2)
                nx2+=dx2
                ny2+=dy2
                while 1<=nx2<=H and 1<=ny2<=W:
                    if (nx2, ny2) not in S:
                        sco2 += A[nx2-1][ny2-1]
                    nx2+=dx2
                    ny2+=dy2

                ans = max(ans, sco+sco2)
print(ans)
0