結果

問題 No.2509 Beam Shateki
ユーザー rlangevinrlangevin
提出日時 2023-12-31 01:02:54
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,272 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 80,768 KB
最終ジャッジ日時 2023-12-31 01:04:07
合計ジャッジ時間 66,690 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
59,708 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 35 ms
53,460 KB
testcase_03 AC 431 ms
77,492 KB
testcase_04 AC 430 ms
77,500 KB
testcase_05 AC 454 ms
77,496 KB
testcase_06 AC 429 ms
77,496 KB
testcase_07 AC 427 ms
77,496 KB
testcase_08 AC 453 ms
77,500 KB
testcase_09 AC 427 ms
77,496 KB
testcase_10 AC 425 ms
77,492 KB
testcase_11 AC 451 ms
77,492 KB
testcase_12 AC 426 ms
77,492 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 189 ms
77,332 KB
testcase_34 AC 674 ms
77,884 KB
testcase_35 AC 1,219 ms
78,384 KB
testcase_36 AC 328 ms
77,036 KB
testcase_37 AC 85 ms
75,964 KB
testcase_38 AC 410 ms
77,944 KB
testcase_39 AC 322 ms
77,300 KB
testcase_40 AC 747 ms
77,648 KB
testcase_41 AC 87 ms
76,176 KB
testcase_42 AC 409 ms
77,324 KB
testcase_43 AC 1,425 ms
78,876 KB
testcase_44 AC 1,665 ms
79,240 KB
testcase_45 AC 317 ms
77,588 KB
testcase_46 AC 481 ms
77,584 KB
testcase_47 AC 1,707 ms
79,256 KB
testcase_48 AC 602 ms
77,816 KB
testcase_49 AC 830 ms
77,952 KB
testcase_50 AC 1,004 ms
78,260 KB
testcase_51 AC 155 ms
76,576 KB
testcase_52 AC 656 ms
77,584 KB
testcase_53 AC 46 ms
61,712 KB
testcase_54 AC 43 ms
61,712 KB
testcase_55 AC 47 ms
62,104 KB
testcase_56 AC 49 ms
62,104 KB
testcase_57 AC 47 ms
62,104 KB
testcase_58 AC 47 ms
62,104 KB
testcase_59 AC 47 ms
62,104 KB
testcase_60 AC 48 ms
62,104 KB
testcase_61 AC 49 ms
62,104 KB
testcase_62 AC 47 ms
62,104 KB
testcase_63 AC 48 ms
62,104 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
        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
                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