結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,584 KB
testcase_01 AC 35 ms
53,584 KB
testcase_02 AC 36 ms
53,584 KB
testcase_03 AC 133 ms
76,292 KB
testcase_04 AC 132 ms
76,292 KB
testcase_05 AC 163 ms
76,292 KB
testcase_06 AC 132 ms
76,288 KB
testcase_07 AC 133 ms
76,292 KB
testcase_08 AC 137 ms
76,292 KB
testcase_09 AC 132 ms
76,288 KB
testcase_10 WA -
testcase_11 AC 133 ms
76,292 KB
testcase_12 AC 138 ms
76,292 KB
testcase_13 AC 428 ms
76,492 KB
testcase_14 AC 439 ms
76,488 KB
testcase_15 AC 417 ms
76,492 KB
testcase_16 AC 417 ms
76,492 KB
testcase_17 AC 441 ms
76,488 KB
testcase_18 AC 420 ms
76,492 KB
testcase_19 AC 417 ms
76,492 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 419 ms
76,492 KB
testcase_23 AC 439 ms
76,492 KB
testcase_24 AC 428 ms
76,492 KB
testcase_25 AC 425 ms
76,492 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 428 ms
76,492 KB
testcase_29 AC 453 ms
76,492 KB
testcase_30 AC 424 ms
76,492 KB
testcase_31 WA -
testcase_32 AC 430 ms
76,492 KB
testcase_33 AC 101 ms
75,952 KB
testcase_34 AC 185 ms
76,568 KB
testcase_35 AC 262 ms
76,412 KB
testcase_36 AC 130 ms
76,324 KB
testcase_37 AC 65 ms
68,488 KB
testcase_38 AC 132 ms
76,436 KB
testcase_39 AC 143 ms
76,448 KB
testcase_40 AC 184 ms
76,572 KB
testcase_41 AC 57 ms
66,548 KB
testcase_42 AC 145 ms
76,232 KB
testcase_43 AC 308 ms
76,436 KB
testcase_44 AC 372 ms
76,612 KB
testcase_45 AC 117 ms
76,252 KB
testcase_46 AC 161 ms
76,292 KB
testcase_47 AC 333 ms
76,452 KB
testcase_48 AC 156 ms
76,412 KB
testcase_49 AC 221 ms
76,524 KB
testcase_50 AC 217 ms
76,500 KB
testcase_51 AC 77 ms
74,664 KB
testcase_52 AC 175 ms
76,284 KB
testcase_53 AC 37 ms
53,584 KB
testcase_54 AC 36 ms
53,584 KB
testcase_55 AC 41 ms
59,828 KB
testcase_56 AC 41 ms
59,828 KB
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 AC 44 ms
59,828 KB
testcase_62 AC 43 ms
59,828 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):
    if i < H * 3:
        HW = 0
    else:
        HW = 1
    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):
        if i < H * 3:
            HW = 0
        else:
            HW = 1
        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