結果

問題 No.2509 Beam Shateki
ユーザー miya145592miya145592
提出日時 2023-10-21 00:24:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,319 bytes
コンパイル時間 185 ms
コンパイル使用メモリ 81,788 KB
実行使用メモリ 76,712 KB
最終ジャッジ日時 2023-10-21 00:24:53
合計ジャッジ時間 21,730 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,504 KB
testcase_01 AC 37 ms
53,504 KB
testcase_02 AC 35 ms
53,504 KB
testcase_03 AC 175 ms
76,496 KB
testcase_04 AC 197 ms
76,492 KB
testcase_05 AC 163 ms
76,488 KB
testcase_06 AC 167 ms
76,484 KB
testcase_07 AC 171 ms
76,496 KB
testcase_08 AC 171 ms
76,264 KB
testcase_09 AC 176 ms
76,496 KB
testcase_10 AC 166 ms
76,484 KB
testcase_11 AC 198 ms
76,484 KB
testcase_12 AC 168 ms
76,476 KB
testcase_13 AC 611 ms
76,684 KB
testcase_14 AC 640 ms
76,684 KB
testcase_15 AC 618 ms
76,704 KB
testcase_16 AC 642 ms
76,704 KB
testcase_17 AC 629 ms
76,684 KB
testcase_18 AC 634 ms
76,684 KB
testcase_19 AC 620 ms
76,708 KB
testcase_20 AC 630 ms
76,680 KB
testcase_21 AC 616 ms
76,708 KB
testcase_22 AC 644 ms
76,684 KB
testcase_23 AC 616 ms
76,708 KB
testcase_24 AC 631 ms
76,688 KB
testcase_25 AC 628 ms
76,708 KB
testcase_26 AC 619 ms
76,704 KB
testcase_27 AC 608 ms
76,688 KB
testcase_28 AC 634 ms
76,684 KB
testcase_29 AC 604 ms
76,708 KB
testcase_30 AC 632 ms
76,712 KB
testcase_31 WA -
testcase_32 AC 648 ms
76,712 KB
testcase_33 AC 104 ms
75,988 KB
testcase_34 AC 221 ms
76,584 KB
testcase_35 AC 389 ms
76,548 KB
testcase_36 AC 151 ms
76,352 KB
testcase_37 AC 72 ms
73,336 KB
testcase_38 AC 161 ms
76,252 KB
testcase_39 AC 160 ms
76,308 KB
testcase_40 AC 259 ms
76,620 KB
testcase_41 AC 58 ms
68,376 KB
testcase_42 AC 171 ms
76,588 KB
testcase_43 AC 407 ms
76,676 KB
testcase_44 AC 476 ms
76,524 KB
testcase_45 AC 152 ms
76,472 KB
testcase_46 AC 203 ms
76,272 KB
testcase_47 AC 489 ms
76,464 KB
testcase_48 AC 199 ms
76,316 KB
testcase_49 AC 263 ms
76,464 KB
testcase_50 AC 340 ms
76,420 KB
testcase_51 AC 100 ms
75,928 KB
testcase_52 AC 246 ms
76,316 KB
testcase_53 AC 43 ms
59,756 KB
testcase_54 AC 43 ms
59,756 KB
testcase_55 AC 43 ms
59,756 KB
testcase_56 AC 42 ms
59,756 KB
testcase_57 AC 43 ms
59,756 KB
testcase_58 WA -
testcase_59 AC 42 ms
59,756 KB
testcase_60 WA -
testcase_61 WA -
testcase_62 AC 45 ms
59,756 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+2):
    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+1)
        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+1, H+W+2):
            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+1)
                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