結果
問題 | No.2509 Beam Shateki |
ユーザー | rlangevin |
提出日時 | 2023-12-31 01:16:35 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,082 ms / 2,000 ms |
コード長 | 1,559 bytes |
コンパイル時間 | 635 ms |
コンパイル使用メモリ | 82,584 KB |
実行使用メモリ | 79,096 KB |
最終ジャッジ日時 | 2024-09-27 16:59:43 |
合計ジャッジ時間 | 33,301 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 36 ms
53,108 KB |
testcase_01 | AC | 36 ms
53,532 KB |
testcase_02 | AC | 34 ms
53,652 KB |
testcase_03 | AC | 241 ms
77,936 KB |
testcase_04 | AC | 245 ms
77,680 KB |
testcase_05 | AC | 244 ms
77,676 KB |
testcase_06 | AC | 245 ms
77,792 KB |
testcase_07 | AC | 244 ms
77,808 KB |
testcase_08 | AC | 249 ms
78,044 KB |
testcase_09 | AC | 241 ms
78,064 KB |
testcase_10 | AC | 244 ms
78,156 KB |
testcase_11 | AC | 239 ms
77,804 KB |
testcase_12 | AC | 243 ms
78,064 KB |
testcase_13 | AC | 1,061 ms
78,612 KB |
testcase_14 | AC | 1,048 ms
78,948 KB |
testcase_15 | AC | 1,023 ms
78,812 KB |
testcase_16 | AC | 1,023 ms
78,732 KB |
testcase_17 | AC | 1,023 ms
78,860 KB |
testcase_18 | AC | 1,076 ms
78,792 KB |
testcase_19 | AC | 1,060 ms
78,868 KB |
testcase_20 | AC | 1,065 ms
79,020 KB |
testcase_21 | AC | 1,069 ms
78,748 KB |
testcase_22 | AC | 1,082 ms
78,600 KB |
testcase_23 | AC | 1,071 ms
78,616 KB |
testcase_24 | AC | 1,058 ms
79,096 KB |
testcase_25 | AC | 1,047 ms
79,024 KB |
testcase_26 | AC | 1,033 ms
78,688 KB |
testcase_27 | AC | 1,069 ms
79,044 KB |
testcase_28 | AC | 1,051 ms
78,808 KB |
testcase_29 | AC | 1,036 ms
78,756 KB |
testcase_30 | AC | 1,035 ms
78,632 KB |
testcase_31 | AC | 1,046 ms
78,812 KB |
testcase_32 | AC | 1,067 ms
79,032 KB |
testcase_33 | AC | 142 ms
76,976 KB |
testcase_34 | AC | 328 ms
77,580 KB |
testcase_35 | AC | 556 ms
77,944 KB |
testcase_36 | AC | 196 ms
77,808 KB |
testcase_37 | AC | 74 ms
76,360 KB |
testcase_38 | AC | 216 ms
77,744 KB |
testcase_39 | AC | 206 ms
77,620 KB |
testcase_40 | AC | 367 ms
77,596 KB |
testcase_41 | AC | 76 ms
76,280 KB |
testcase_42 | AC | 246 ms
77,764 KB |
testcase_43 | AC | 657 ms
77,960 KB |
testcase_44 | AC | 840 ms
78,972 KB |
testcase_45 | AC | 212 ms
77,596 KB |
testcase_46 | AC | 284 ms
77,616 KB |
testcase_47 | AC | 817 ms
78,120 KB |
testcase_48 | AC | 311 ms
77,868 KB |
testcase_49 | AC | 431 ms
77,396 KB |
testcase_50 | AC | 478 ms
78,076 KB |
testcase_51 | AC | 111 ms
76,580 KB |
testcase_52 | AC | 356 ms
77,864 KB |
testcase_53 | AC | 42 ms
60,272 KB |
testcase_54 | AC | 40 ms
60,212 KB |
testcase_55 | AC | 45 ms
61,816 KB |
testcase_56 | AC | 46 ms
61,748 KB |
testcase_57 | AC | 45 ms
62,708 KB |
testcase_58 | AC | 46 ms
62,272 KB |
testcase_59 | AC | 45 ms
61,512 KB |
testcase_60 | AC | 44 ms
62,184 KB |
testcase_61 | AC | 44 ms
61,404 KB |
testcase_62 | AC | 47 ms
61,188 KB |
testcase_63 | AC | 47 ms
62,036 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*W+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*W+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 v in S: xs, ys = divmod(v, W) temp += A[xs][ys] ans = max(ans, temp) print(ans)