結果

問題 No.45 回転寿司
ユーザー あかりきあかりき
提出日時 2021-02-08 10:51:40
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 95 ms / 5,000 ms
コード長 231 bytes
コンパイル時間 260 ms
コンパイル使用メモリ 86,956 KB
実行使用メモリ 76,524 KB
最終ジャッジ日時 2023-09-18 16:55:38
合計ジャッジ時間 4,369 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 84 ms
76,360 KB
testcase_01 AC 85 ms
76,396 KB
testcase_02 AC 92 ms
76,228 KB
testcase_03 AC 92 ms
76,524 KB
testcase_04 AC 87 ms
76,516 KB
testcase_05 AC 79 ms
76,068 KB
testcase_06 AC 85 ms
76,352 KB
testcase_07 AC 93 ms
76,324 KB
testcase_08 AC 81 ms
76,124 KB
testcase_09 AC 95 ms
76,316 KB
testcase_10 AC 85 ms
76,300 KB
testcase_11 AC 80 ms
76,300 KB
testcase_12 AC 94 ms
76,128 KB
testcase_13 AC 79 ms
76,208 KB
testcase_14 AC 80 ms
76,024 KB
testcase_15 AC 85 ms
76,328 KB
testcase_16 AC 80 ms
76,336 KB
testcase_17 AC 82 ms
76,124 KB
testcase_18 AC 80 ms
76,148 KB
testcase_19 AC 89 ms
76,404 KB
testcase_20 AC 77 ms
75,712 KB
testcase_21 AC 79 ms
75,928 KB
testcase_22 AC 75 ms
71,336 KB
testcase_23 AC 70 ms
71,256 KB
testcase_24 AC 69 ms
71,088 KB
testcase_25 AC 71 ms
71,092 KB
testcase_26 AC 83 ms
76,008 KB
testcase_27 AC 90 ms
76,100 KB
testcase_28 AC 83 ms
76,388 KB
testcase_29 AC 88 ms
76,356 KB
testcase_30 AC 89 ms
76,508 KB
testcase_31 AC 70 ms
71,232 KB
testcase_32 AC 71 ms
71,428 KB
testcase_33 AC 95 ms
76,340 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
v=list(map(int,input().split()))
dp=[[0]*2 for i in range(n+1)]
for i in range(n):
  for j in range(n):
    dp[i+1][0]=max(dp[i+1][0],dp[i][0],dp[i][1])
    dp[i+1][1]=max(dp[i+1][1],dp[i][0]+v[i])
print(max(dp[-1]))
0