結果
問題 | No.2509 Beam Shateki |
ユーザー | ntuda |
提出日時 | 2023-12-14 19:30:10 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,254 bytes |
コンパイル時間 | 431 ms |
コンパイル使用メモリ | 82,848 KB |
実行使用メモリ | 77,192 KB |
最終ジャッジ日時 | 2024-09-27 05:45:40 |
合計ジャッジ時間 | 7,846 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
52,812 KB |
testcase_01 | AC | 38 ms
54,116 KB |
testcase_02 | AC | 38 ms
52,892 KB |
testcase_03 | AC | 101 ms
76,584 KB |
testcase_04 | AC | 94 ms
76,664 KB |
testcase_05 | AC | 91 ms
76,664 KB |
testcase_06 | AC | 92 ms
76,432 KB |
testcase_07 | AC | 92 ms
77,024 KB |
testcase_08 | AC | 92 ms
76,552 KB |
testcase_09 | AC | 93 ms
76,560 KB |
testcase_10 | AC | 91 ms
76,648 KB |
testcase_11 | AC | 92 ms
76,540 KB |
testcase_12 | AC | 93 ms
76,952 KB |
testcase_13 | AC | 104 ms
76,752 KB |
testcase_14 | AC | 106 ms
76,816 KB |
testcase_15 | AC | 106 ms
76,704 KB |
testcase_16 | AC | 105 ms
76,952 KB |
testcase_17 | AC | 106 ms
76,688 KB |
testcase_18 | AC | 105 ms
76,932 KB |
testcase_19 | AC | 107 ms
77,080 KB |
testcase_20 | AC | 106 ms
76,744 KB |
testcase_21 | AC | 111 ms
76,944 KB |
testcase_22 | AC | 106 ms
76,676 KB |
testcase_23 | AC | 105 ms
76,964 KB |
testcase_24 | AC | 106 ms
76,940 KB |
testcase_25 | AC | 105 ms
76,944 KB |
testcase_26 | AC | 105 ms
76,740 KB |
testcase_27 | AC | 107 ms
77,192 KB |
testcase_28 | AC | 106 ms
76,948 KB |
testcase_29 | AC | 105 ms
76,696 KB |
testcase_30 | AC | 103 ms
76,700 KB |
testcase_31 | AC | 105 ms
76,700 KB |
testcase_32 | AC | 99 ms
76,824 KB |
testcase_33 | AC | 66 ms
71,772 KB |
testcase_34 | AC | 87 ms
76,716 KB |
testcase_35 | AC | 89 ms
76,772 KB |
testcase_36 | AC | 80 ms
76,412 KB |
testcase_37 | AC | 50 ms
65,832 KB |
testcase_38 | AC | 85 ms
76,640 KB |
testcase_39 | AC | 78 ms
76,488 KB |
testcase_40 | AC | 85 ms
76,596 KB |
testcase_41 | WA | - |
testcase_42 | AC | 83 ms
76,536 KB |
testcase_43 | AC | 94 ms
76,876 KB |
testcase_44 | AC | 90 ms
76,904 KB |
testcase_45 | AC | 84 ms
76,780 KB |
testcase_46 | AC | 78 ms
76,504 KB |
testcase_47 | AC | 105 ms
76,800 KB |
testcase_48 | AC | 100 ms
76,724 KB |
testcase_49 | AC | 95 ms
76,856 KB |
testcase_50 | AC | 98 ms
76,584 KB |
testcase_51 | AC | 64 ms
70,288 KB |
testcase_52 | AC | 90 ms
76,624 KB |
testcase_53 | AC | 36 ms
53,532 KB |
testcase_54 | AC | 34 ms
53,200 KB |
testcase_55 | AC | 35 ms
54,192 KB |
testcase_56 | WA | - |
testcase_57 | AC | 34 ms
53,540 KB |
testcase_58 | AC | 33 ms
53,008 KB |
testcase_59 | AC | 35 ms
54,288 KB |
testcase_60 | AC | 33 ms
53,492 KB |
testcase_61 | AC | 33 ms
53,748 KB |
testcase_62 | AC | 32 ms
54,648 KB |
testcase_63 | AC | 32 ms
53,712 KB |
ソースコード
H, W = map(int, input().split()) W = 2 * H + W - 2 A = [[0] * (H - 1) + list(map(int, input().split())) + [0] * (H - 1) for _ in range(H)] N = W * 3 + H D = [(1, -1), (1, 0), (1, 1), (0, 1)] S = [0] * N for i in range(N): if i < W * 3: y = i // 3 x = 0 d = i % 3 else: y = 0 x = i - W * 3 d = 3 tmp = 0 while 0 <= x < H and 0 <= y < W: tmp += A[x][y] x += D[d][0] y += D[d][1] S[i] = tmp #for i in range(H): #ptint(*A[i]) #ptint(S) ans = 0 for i in range(N - 1): if i < W * 3: y1 = i // 3 x1 = 0 d1 = i % 3 else: y1 = 0 x1 = i - W * 3 d1 = 3 for j in range(i + 1, N): tmp = S[i] + S[j] if j < W * 3: y2 = j // 3 x2 = 0 d2 = j % 3 else: x2 = j - W * 3 y2 = 0 d2 = 3 if d2 == 3: if d1 == 0: if 0 <= y1 - x2 < W: tmp -= A[x2][y1 - x2] elif d1 == 1: tmp -= A[x2][y1] else: # d1 == 2 if 0 <= y1 + x2 < W: tmp -= A[x2][y1 + x2] ans = max(ans, tmp) #ptint(i,j,":","a",x1,y1,d1,x2,y2,d2,":",S[i]+S[j],tmp) continue if y1 == y2: tmp -= A[0][y1] #ptint(i,j,":","b",x1,y1,d1,x2,y2,d2,":",S[i]+S[j],tmp) ans = max(ans, tmp) continue if d2 == 0: if d1 == 2: yt = y2 - y1 if yt % 2 == 0 and yt // 2 < H: tmp -= A[yt // 2][(y2 + y1) // 2] elif d1 == 1: if y2 - y1 < H: tmp -= A[y2 - y1][y1] #ptint(i,j,":","c",x1,y1,d1,x2,y2,d2,":",S[i]+S[j],tmp) ans = max(ans, tmp) continue if d2 == 1 and d1 == 2: if y2 - y1 < H: tmp -= A[y2 - y1][y2] #ptint(i, j, ":","d", x1, y1, d1, x2, y2, d2, ":", S[i] + S[j], tmp) ans = max(ans, tmp) continue #ptint(i, j, ":","e", x1, y1, d1, x2, y2, d2, ":", S[i] + S[j], tmp) ans = max(ans, tmp) print(ans)