結果
問題 | No.2889 Rusk |
ユーザー | tassei903 |
提出日時 | 2024-09-13 23:38:08 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 291 ms / 2,000 ms |
コード長 | 1,098 bytes |
コンパイル時間 | 441 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 144,348 KB |
最終ジャッジ日時 | 2024-09-13 23:38:20 |
合計ジャッジ時間 | 10,982 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 39 ms
52,864 KB |
testcase_01 | AC | 38 ms
52,480 KB |
testcase_02 | AC | 37 ms
52,480 KB |
testcase_03 | AC | 38 ms
52,096 KB |
testcase_04 | AC | 39 ms
52,736 KB |
testcase_05 | AC | 39 ms
52,224 KB |
testcase_06 | AC | 39 ms
53,120 KB |
testcase_07 | AC | 42 ms
52,608 KB |
testcase_08 | AC | 39 ms
53,120 KB |
testcase_09 | AC | 40 ms
52,992 KB |
testcase_10 | AC | 39 ms
52,224 KB |
testcase_11 | AC | 39 ms
52,608 KB |
testcase_12 | AC | 39 ms
52,992 KB |
testcase_13 | AC | 40 ms
52,864 KB |
testcase_14 | AC | 63 ms
73,856 KB |
testcase_15 | AC | 88 ms
88,264 KB |
testcase_16 | AC | 172 ms
109,892 KB |
testcase_17 | AC | 82 ms
84,352 KB |
testcase_18 | AC | 126 ms
98,916 KB |
testcase_19 | AC | 205 ms
125,776 KB |
testcase_20 | AC | 244 ms
128,764 KB |
testcase_21 | AC | 200 ms
125,108 KB |
testcase_22 | AC | 211 ms
127,480 KB |
testcase_23 | AC | 163 ms
112,792 KB |
testcase_24 | AC | 239 ms
129,444 KB |
testcase_25 | AC | 170 ms
112,212 KB |
testcase_26 | AC | 205 ms
125,660 KB |
testcase_27 | AC | 237 ms
129,352 KB |
testcase_28 | AC | 207 ms
119,160 KB |
testcase_29 | AC | 189 ms
122,916 KB |
testcase_30 | AC | 187 ms
122,204 KB |
testcase_31 | AC | 239 ms
128,744 KB |
testcase_32 | AC | 142 ms
99,512 KB |
testcase_33 | AC | 87 ms
81,280 KB |
testcase_34 | AC | 291 ms
141,148 KB |
testcase_35 | AC | 278 ms
141,012 KB |
testcase_36 | AC | 255 ms
141,400 KB |
testcase_37 | AC | 283 ms
141,088 KB |
testcase_38 | AC | 281 ms
141,392 KB |
testcase_39 | AC | 223 ms
137,492 KB |
testcase_40 | AC | 180 ms
114,360 KB |
testcase_41 | AC | 234 ms
144,348 KB |
testcase_42 | AC | 181 ms
117,208 KB |
testcase_43 | AC | 111 ms
97,280 KB |
testcase_44 | AC | 236 ms
138,144 KB |
testcase_45 | AC | 177 ms
115,036 KB |
testcase_46 | AC | 89 ms
88,812 KB |
testcase_47 | AC | 117 ms
99,712 KB |
testcase_48 | AC | 200 ms
132,140 KB |
testcase_49 | AC | 39 ms
52,096 KB |
testcase_50 | AC | 39 ms
52,352 KB |
testcase_51 | AC | 38 ms
52,096 KB |
testcase_52 | AC | 38 ms
52,096 KB |
testcase_53 | AC | 39 ms
52,480 KB |
testcase_54 | AC | 271 ms
140,708 KB |
ソースコード
import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### n = ni() a = na() b = na() c = na() inf = 10**18 dp = [[-inf] * 5 for i in range(n+1)] dp[0] = [0] * 5 for i in range(n): dp[i+1][0] = dp[i][0] + a[i] dp[i+1][1] = dp[i][1] + b[i] dp[i+1][2] = dp[i][2] + c[i] dp[i+1][3] = dp[i][3] + b[i] dp[i+1][4] = dp[i][4] + a[i] for j in range(4): dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j]) A = max(dp[n]) inf = 10**18 dp = [[-inf] * 5 for i in range(n+1)] dp[0] = [0] * 5 for i in range(n): dp[i+1][0] = dp[i][0] + a[i] dp[i+1][1] = dp[i][1] + b[i] dp[i+1][2] = dp[i][2] + a[i] dp[i+1][3] = dp[i][3] + b[i] dp[i+1][4] = dp[i][4] + a[i] for j in range(4): dp[i+1][j+1] = max(dp[i+1][j+1], dp[i+1][j]) B = max(dp[n]) print(max(A,B))