結果
問題 | No.2889 Rusk |
ユーザー | ra5anchor |
提出日時 | 2024-09-13 22:17:42 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,335 bytes |
コンパイル時間 | 328 ms |
コンパイル使用メモリ | 82,232 KB |
実行使用メモリ | 145,208 KB |
最終ジャッジ日時 | 2024-09-13 22:18:12 |
合計ジャッジ時間 | 10,277 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
52,892 KB |
testcase_01 | AC | 35 ms
53,232 KB |
testcase_02 | AC | 37 ms
53,288 KB |
testcase_03 | AC | 35 ms
53,400 KB |
testcase_04 | AC | 37 ms
52,804 KB |
testcase_05 | AC | 35 ms
53,000 KB |
testcase_06 | AC | 37 ms
53,428 KB |
testcase_07 | AC | 36 ms
53,348 KB |
testcase_08 | AC | 37 ms
53,624 KB |
testcase_09 | AC | 37 ms
53,872 KB |
testcase_10 | WA | - |
testcase_11 | AC | 37 ms
53,876 KB |
testcase_12 | AC | 38 ms
53,928 KB |
testcase_13 | AC | 36 ms
54,812 KB |
testcase_14 | AC | 73 ms
77,996 KB |
testcase_15 | AC | 99 ms
88,184 KB |
testcase_16 | AC | 177 ms
110,016 KB |
testcase_17 | AC | 88 ms
83,712 KB |
testcase_18 | AC | 138 ms
95,848 KB |
testcase_19 | AC | 210 ms
125,220 KB |
testcase_20 | AC | 234 ms
129,856 KB |
testcase_21 | AC | 248 ms
124,932 KB |
testcase_22 | AC | 196 ms
127,208 KB |
testcase_23 | AC | 176 ms
112,484 KB |
testcase_24 | AC | 233 ms
127,696 KB |
testcase_25 | AC | 170 ms
112,140 KB |
testcase_26 | AC | 210 ms
126,004 KB |
testcase_27 | AC | 241 ms
131,240 KB |
testcase_28 | AC | 186 ms
119,392 KB |
testcase_29 | AC | 178 ms
122,840 KB |
testcase_30 | AC | 208 ms
122,268 KB |
testcase_31 | AC | 244 ms
130,308 KB |
testcase_32 | AC | 142 ms
97,624 KB |
testcase_33 | AC | 89 ms
81,024 KB |
testcase_34 | AC | 260 ms
142,996 KB |
testcase_35 | AC | 273 ms
143,692 KB |
testcase_36 | AC | 266 ms
143,948 KB |
testcase_37 | AC | 280 ms
143,948 KB |
testcase_38 | AC | 296 ms
143,868 KB |
testcase_39 | AC | 232 ms
138,572 KB |
testcase_40 | AC | 199 ms
114,264 KB |
testcase_41 | AC | 237 ms
145,208 KB |
testcase_42 | AC | 205 ms
112,896 KB |
testcase_43 | AC | 134 ms
96,640 KB |
testcase_44 | AC | 237 ms
138,184 KB |
testcase_45 | AC | 206 ms
114,344 KB |
testcase_46 | AC | 111 ms
88,576 KB |
testcase_47 | AC | 143 ms
99,376 KB |
testcase_48 | AC | 215 ms
132,184 KB |
testcase_49 | AC | 36 ms
52,224 KB |
testcase_50 | AC | 34 ms
52,352 KB |
testcase_51 | AC | 35 ms
52,224 KB |
testcase_52 | AC | 36 ms
52,352 KB |
testcase_53 | AC | 37 ms
51,968 KB |
testcase_54 | AC | 235 ms
135,868 KB |
ソースコード
N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) dp = [[-10**18]*5 for _ in range(N+1)] for j in range(5): dp[0][j] = 0 for i in range(N): dp[i+1][0] = max(dp[i+1][0], dp[i][0] + A[i]) dp[i+1][1] = max(dp[i+1][1], dp[i][0] + A[i]) dp[i+1][1] = max(dp[i+1][1], dp[i][1] + B[i]) dp[i+1][2] = max(dp[i+1][2], dp[i][1] + B[i]) dp[i+1][2] = max(dp[i+1][2], dp[i][2] + C[i]) dp[i+1][3] = max(dp[i+1][3], dp[i][2] + C[i]) dp[i+1][3] = max(dp[i+1][3], dp[i][3] + B[i]) dp[i+1][4] = max(dp[i+1][4], dp[i][3] + B[i]) dp[i+1][4] = max(dp[i+1][4], dp[i][4] + A[i]) ans1 = max(dp[N]) dp_ = [[-10**18]*5 for _ in range(N+1)] for j in range(5): dp_[0][j] = 0 for i in range(N): dp_[i+1][0] = max(dp_[i+1][0], dp_[i][0] + A[i]) dp_[i+1][1] = max(dp_[i+1][1], dp_[i][0] + A[i]) dp_[i+1][1] = max(dp_[i+1][1], dp_[i][1] + B[i]) dp_[i+1][2] = max(dp_[i+1][2], dp_[i][1] + B[i]) dp_[i+1][2] = max(dp_[i+1][2], dp_[i][2] + A[i]) dp_[i+1][3] = max(dp_[i+1][3], dp_[i][2] + A[i]) dp_[i+1][3] = max(dp_[i+1][3], dp_[i][3] + B[i]) dp_[i+1][4] = max(dp_[i+1][4], dp_[i][3] + B[i]) dp_[i+1][4] = max(dp_[i+1][4], dp_[i][4] + A[i]) ans2 = max(dp_[N]) print(max(ans1, ans2))