結果
問題 | No.2509 Beam Shateki |
ユーザー | rlangevin |
提出日時 | 2023-12-31 01:14:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,694 ms / 2,000 ms |
コード長 | 1,524 bytes |
コンパイル時間 | 518 ms |
コンパイル使用メモリ | 82,280 KB |
実行使用メモリ | 80,700 KB |
最終ジャッジ日時 | 2024-09-27 16:59:03 |
合計ジャッジ時間 | 46,842 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 34 ms
53,288 KB |
testcase_01 | AC | 33 ms
52,396 KB |
testcase_02 | AC | 32 ms
52,912 KB |
testcase_03 | AC | 300 ms
77,472 KB |
testcase_04 | AC | 300 ms
77,596 KB |
testcase_05 | AC | 309 ms
77,456 KB |
testcase_06 | AC | 311 ms
77,472 KB |
testcase_07 | AC | 365 ms
77,596 KB |
testcase_08 | AC | 309 ms
77,720 KB |
testcase_09 | AC | 308 ms
77,452 KB |
testcase_10 | AC | 299 ms
77,580 KB |
testcase_11 | AC | 295 ms
77,564 KB |
testcase_12 | AC | 300 ms
77,724 KB |
testcase_13 | AC | 1,555 ms
80,388 KB |
testcase_14 | AC | 1,583 ms
80,564 KB |
testcase_15 | AC | 1,596 ms
80,248 KB |
testcase_16 | AC | 1,532 ms
80,372 KB |
testcase_17 | AC | 1,553 ms
80,400 KB |
testcase_18 | AC | 1,576 ms
80,296 KB |
testcase_19 | AC | 1,560 ms
80,340 KB |
testcase_20 | AC | 1,588 ms
80,172 KB |
testcase_21 | AC | 1,627 ms
80,368 KB |
testcase_22 | AC | 1,541 ms
80,700 KB |
testcase_23 | AC | 1,585 ms
80,036 KB |
testcase_24 | AC | 1,626 ms
80,328 KB |
testcase_25 | AC | 1,582 ms
80,552 KB |
testcase_26 | AC | 1,617 ms
80,176 KB |
testcase_27 | AC | 1,694 ms
80,144 KB |
testcase_28 | AC | 1,670 ms
80,380 KB |
testcase_29 | AC | 1,666 ms
80,104 KB |
testcase_30 | AC | 1,648 ms
80,168 KB |
testcase_31 | AC | 1,603 ms
80,232 KB |
testcase_32 | AC | 1,549 ms
80,476 KB |
testcase_33 | AC | 150 ms
77,128 KB |
testcase_34 | AC | 459 ms
77,680 KB |
testcase_35 | AC | 840 ms
78,520 KB |
testcase_36 | AC | 247 ms
77,564 KB |
testcase_37 | AC | 78 ms
76,404 KB |
testcase_38 | AC | 265 ms
77,968 KB |
testcase_39 | AC | 244 ms
77,596 KB |
testcase_40 | AC | 506 ms
77,828 KB |
testcase_41 | AC | 78 ms
76,324 KB |
testcase_42 | AC | 311 ms
78,160 KB |
testcase_43 | AC | 981 ms
78,692 KB |
testcase_44 | AC | 1,197 ms
79,116 KB |
testcase_45 | AC | 247 ms
77,856 KB |
testcase_46 | AC | 361 ms
77,476 KB |
testcase_47 | AC | 1,175 ms
78,896 KB |
testcase_48 | AC | 395 ms
77,708 KB |
testcase_49 | AC | 582 ms
77,868 KB |
testcase_50 | AC | 681 ms
78,908 KB |
testcase_51 | AC | 121 ms
76,676 KB |
testcase_52 | AC | 471 ms
77,988 KB |
testcase_53 | AC | 39 ms
59,964 KB |
testcase_54 | AC | 38 ms
59,572 KB |
testcase_55 | AC | 44 ms
61,960 KB |
testcase_56 | AC | 42 ms
62,992 KB |
testcase_57 | AC | 41 ms
61,848 KB |
testcase_58 | AC | 43 ms
62,572 KB |
testcase_59 | AC | 42 ms
62,344 KB |
testcase_60 | AC | 42 ms
61,604 KB |
testcase_61 | AC | 43 ms
62,920 KB |
testcase_62 | AC | 42 ms
62,876 KB |
testcase_63 | AC | 46 ms
61,320 KB |
ソースコード
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)