結果

問題 No.2509 Beam Shateki
ユーザー rlangevinrlangevin
提出日時 2023-12-31 01:14:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,837 ms / 2,000 ms
コード長 1,524 bytes
コンパイル時間 217 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 80,136 KB
最終ジャッジ日時 2023-12-31 01:15:00
合計ジャッジ時間 52,972 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,460 KB
testcase_01 AC 35 ms
53,460 KB
testcase_02 AC 35 ms
53,460 KB
testcase_03 AC 344 ms
77,048 KB
testcase_04 AC 339 ms
76,916 KB
testcase_05 AC 338 ms
76,916 KB
testcase_06 AC 364 ms
77,048 KB
testcase_07 AC 352 ms
76,916 KB
testcase_08 AC 341 ms
77,040 KB
testcase_09 AC 367 ms
77,048 KB
testcase_10 AC 368 ms
76,916 KB
testcase_11 AC 340 ms
77,048 KB
testcase_12 AC 342 ms
76,916 KB
testcase_13 AC 1,808 ms
79,880 KB
testcase_14 AC 1,791 ms
80,008 KB
testcase_15 AC 1,819 ms
79,880 KB
testcase_16 AC 1,780 ms
79,880 KB
testcase_17 AC 1,773 ms
79,880 KB
testcase_18 AC 1,810 ms
80,008 KB
testcase_19 AC 1,775 ms
79,880 KB
testcase_20 AC 1,814 ms
80,008 KB
testcase_21 AC 1,810 ms
79,752 KB
testcase_22 AC 1,835 ms
80,136 KB
testcase_23 AC 1,812 ms
79,752 KB
testcase_24 AC 1,837 ms
79,880 KB
testcase_25 AC 1,800 ms
79,880 KB
testcase_26 AC 1,783 ms
79,880 KB
testcase_27 AC 1,811 ms
79,880 KB
testcase_28 AC 1,783 ms
79,752 KB
testcase_29 AC 1,772 ms
80,008 KB
testcase_30 AC 1,791 ms
80,008 KB
testcase_31 AC 1,765 ms
80,008 KB
testcase_32 AC 1,812 ms
80,008 KB
testcase_33 AC 165 ms
77,036 KB
testcase_34 AC 500 ms
77,280 KB
testcase_35 AC 939 ms
78,120 KB
testcase_36 AC 274 ms
77,288 KB
testcase_37 AC 84 ms
75,976 KB
testcase_38 AC 295 ms
77,424 KB
testcase_39 AC 300 ms
77,308 KB
testcase_40 AC 569 ms
77,432 KB
testcase_41 AC 88 ms
76,120 KB
testcase_42 AC 343 ms
77,424 KB
testcase_43 AC 1,117 ms
78,620 KB
testcase_44 AC 1,319 ms
78,452 KB
testcase_45 AC 283 ms
77,436 KB
testcase_46 AC 382 ms
77,064 KB
testcase_47 AC 1,316 ms
78,616 KB
testcase_48 AC 441 ms
77,296 KB
testcase_49 AC 674 ms
77,700 KB
testcase_50 AC 768 ms
78,096 KB
testcase_51 AC 137 ms
76,384 KB
testcase_52 AC 531 ms
77,464 KB
testcase_53 AC 41 ms
59,452 KB
testcase_54 AC 41 ms
59,452 KB
testcase_55 AC 45 ms
61,968 KB
testcase_56 AC 45 ms
61,968 KB
testcase_57 AC 44 ms
61,968 KB
testcase_58 AC 45 ms
61,968 KB
testcase_59 AC 45 ms
61,968 KB
testcase_60 AC 46 ms
61,968 KB
testcase_61 AC 46 ms
61,968 KB
testcase_62 AC 47 ms
61,968 KB
testcase_63 AC 46 ms
61,968 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, input().split())
A = []
for i in range(H):
    A.append(list(map(int, input().split())))
    
L = []
for i in range(H):
    for j in range(W):
        if i == 0 or j == W - 1 or j == 0:
            L.append((i, j))
            
dx = [1, 0, 1, 1]
dy = [0, 1, 1, -1]

def f(x1, y1, k1, x2, y2, k2):
    S = set()
    while True:
        S.add((x1, y1))
        x1 += dx[k1]
        y1 += dy[k1]
        if x1 < 0 or x1 > H - 1 or y1 < 0 or y1 > W - 1:
            break
    while True:
        S.add((x2, y2))
        x2 += dx[k2]
        y2 += dy[k2]
        if x2 < 0 or x2 > H - 1 or y2 < 0 or y2 > W - 1:
            break
    return S

ans = 0
for a in range(len(L)):
    x1, y1 = L[a]
    for k1 in range(4):
        if k1 == 0 and x1 != 0:
            continue
        if k1 == 1 and y1 != 0:
            continue
        if k1 == 2 and y1 == W - 1:
            continue
        if k1 == 3 and y1 == 0:
            continue
        for b in range(a, len(L)):
            x2, y2 = L[b]
            for k2 in range(4):
                if k2 == 0 and x2 != 0:
                    continue
                if k2 == 1 and y2 != 0:
                    continue
                if k2 == 2 and y2 == W - 1:
                    continue
                if k2 == 3 and y2 == 0:
                    continue
                S = f(x1, y1, k1, x2, y2, k2)
                temp = 0
                for xs, ys in S:
                    temp += A[xs][ys]
                ans = max(ans, temp)
                
print(ans)
0