結果

問題 No.45 回転寿司
ユーザー AEnAEn
提出日時 2022-05-14 16:16:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 5,000 ms
コード長 253 bytes
コンパイル時間 1,376 ms
コンパイル使用メモリ 87,096 KB
実行使用メモリ 71,532 KB
最終ジャッジ日時 2023-09-30 07:49:50
合計ジャッジ時間 5,122 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,388 KB
testcase_01 AC 81 ms
71,140 KB
testcase_02 AC 78 ms
71,292 KB
testcase_03 AC 78 ms
71,232 KB
testcase_04 AC 77 ms
71,100 KB
testcase_05 AC 76 ms
71,384 KB
testcase_06 AC 77 ms
71,312 KB
testcase_07 AC 80 ms
71,100 KB
testcase_08 AC 77 ms
71,100 KB
testcase_09 AC 78 ms
71,096 KB
testcase_10 AC 81 ms
71,244 KB
testcase_11 AC 81 ms
71,096 KB
testcase_12 AC 77 ms
71,224 KB
testcase_13 AC 79 ms
71,316 KB
testcase_14 AC 79 ms
71,520 KB
testcase_15 AC 80 ms
71,304 KB
testcase_16 AC 77 ms
71,348 KB
testcase_17 AC 77 ms
71,260 KB
testcase_18 AC 79 ms
71,124 KB
testcase_19 AC 79 ms
71,232 KB
testcase_20 AC 79 ms
71,456 KB
testcase_21 AC 79 ms
71,296 KB
testcase_22 AC 78 ms
71,212 KB
testcase_23 AC 76 ms
71,004 KB
testcase_24 AC 78 ms
71,256 KB
testcase_25 AC 76 ms
71,212 KB
testcase_26 AC 79 ms
71,432 KB
testcase_27 AC 79 ms
71,332 KB
testcase_28 AC 77 ms
71,004 KB
testcase_29 AC 80 ms
71,244 KB
testcase_30 AC 80 ms
71,092 KB
testcase_31 AC 80 ms
71,432 KB
testcase_32 AC 77 ms
71,336 KB
testcase_33 AC 79 ms
71,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
V = list(map(int,input().split()))

dp = [[0]*2 for _ in range(N)]
dp[0][1] = V[0]
for i in range(1, N):
    dp[i][0] = max(dp[i][0], dp[i-1][1], dp[i-1][0])
    dp[i][1] = max(dp[i][1], dp[i-1][0]+V[i])
print(max(dp[-1][0], dp[-1][1]))
0