結果

問題 No.2509 Beam Shateki
ユーザー ntudantuda
提出日時 2023-10-28 16:54:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,101 bytes
コンパイル時間 288 ms
コンパイル使用メモリ 81,884 KB
実行使用メモリ 76,724 KB
最終ジャッジ日時 2023-10-28 16:54:53
合計ジャッジ時間 21,100 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,596 KB
testcase_01 AC 38 ms
53,596 KB
testcase_02 AC 36 ms
53,596 KB
testcase_03 AC 163 ms
76,276 KB
testcase_04 AC 165 ms
76,408 KB
testcase_05 AC 166 ms
76,412 KB
testcase_06 AC 169 ms
76,412 KB
testcase_07 AC 165 ms
76,412 KB
testcase_08 AC 166 ms
76,276 KB
testcase_09 AC 162 ms
76,276 KB
testcase_10 AC 164 ms
76,412 KB
testcase_11 AC 166 ms
76,408 KB
testcase_12 AC 166 ms
76,276 KB
testcase_13 AC 676 ms
76,704 KB
testcase_14 AC 648 ms
76,704 KB
testcase_15 AC 682 ms
76,704 KB
testcase_16 AC 649 ms
76,704 KB
testcase_17 AC 679 ms
76,440 KB
testcase_18 AC 650 ms
76,704 KB
testcase_19 AC 644 ms
76,504 KB
testcase_20 AC 647 ms
76,412 KB
testcase_21 AC 651 ms
76,416 KB
testcase_22 AC 682 ms
76,548 KB
testcase_23 AC 658 ms
76,704 KB
testcase_24 AC 646 ms
76,704 KB
testcase_25 AC 663 ms
76,460 KB
testcase_26 AC 645 ms
76,704 KB
testcase_27 AC 646 ms
76,704 KB
testcase_28 AC 648 ms
76,704 KB
testcase_29 AC 648 ms
76,520 KB
testcase_30 AC 667 ms
76,704 KB
testcase_31 WA -
testcase_32 AC 646 ms
76,520 KB
testcase_33 AC 96 ms
75,924 KB
testcase_34 AC 224 ms
76,288 KB
testcase_35 AC 365 ms
76,324 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 AC 156 ms
76,248 KB
testcase_39 RE -
testcase_40 AC 245 ms
76,240 KB
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 AC 500 ms
76,328 KB
testcase_48 AC 196 ms
76,440 KB
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
testcase_55 AC 52 ms
64,352 KB
testcase_56 AC 52 ms
64,352 KB
testcase_57 AC 50 ms
64,352 KB
testcase_58 WA -
testcase_59 AC 50 ms
64,352 KB
testcase_60 WA -
testcase_61 AC 52 ms
64,352 KB
testcase_62 AC 52 ms
64,352 KB
testcase_63 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, input().split())
A = [[0] * (W + 2)]
A += [[0] + list(map(int, input().split())) + [0] for _ in range(H)]
A += [[0] * (W + 2)]
H += 2
W += 2

N = (H + W) * 3
D = [[-1, 1], [0, 1], [1, 1], [1, -1], [1, 0], [1, 1]]
ans = 0
for i in range(N - 1):
    HW = i // (H * 3)
    if HW == 0:
        x = i // 3
        y = 0
    else:
        y = (i - H * 3) // 3
        x = 0
    cnt1 = 0
    P = set()
    dx, dy = D[3 * HW + i % 3]
    x += dx
    y += dy
    while 0 <= x < H and 0 <= y < W and A[x][y] > 0:
        cnt1 += A[x][y]
        P.add((x, y))
        x += dx
        y += dy
    for j in range(i + 1, N):
        HW = j // (H * 3)
        if HW == 0:
            x = j // 3
            y = 0
        else:
            y = (j - H * 3) // 3
            x = 0
        cnt2 = 0
        dx, dy = D[3 * HW + j % 3]
        x += dx
        y += dy
        while 0 <= x < H and 0 <= y < W and A[x][y] > 0:
            if (x, y) not in P:
                cnt2 += A[x][y]
            x += dx
            y += dy
        ans = max(ans, cnt1 + cnt2)
        #print(i,j,cnt1,cnt2)
print(ans)
0