結果

問題 No.45 回転寿司
ユーザー dangodango
提出日時 2023-06-14 21:12:26
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 272 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 79,164 KB
最終ジャッジ日時 2023-09-05 06:56:49
合計ジャッジ時間 4,738 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,444 KB
testcase_01 AC 73 ms
71,300 KB
testcase_02 AC 70 ms
71,348 KB
testcase_03 AC 71 ms
71,524 KB
testcase_04 AC 71 ms
71,208 KB
testcase_05 AC 70 ms
71,200 KB
testcase_06 AC 71 ms
71,384 KB
testcase_07 AC 70 ms
71,324 KB
testcase_08 AC 71 ms
71,524 KB
testcase_09 AC 72 ms
71,284 KB
testcase_10 AC 71 ms
71,164 KB
testcase_11 AC 69 ms
71,316 KB
testcase_12 AC 76 ms
71,164 KB
testcase_13 AC 74 ms
71,372 KB
testcase_14 AC 74 ms
71,060 KB
testcase_15 AC 73 ms
71,292 KB
testcase_16 AC 71 ms
71,512 KB
testcase_17 AC 71 ms
71,424 KB
testcase_18 AC 71 ms
71,056 KB
testcase_19 AC 70 ms
71,172 KB
testcase_20 AC 72 ms
71,280 KB
testcase_21 AC 72 ms
71,312 KB
testcase_22 AC 72 ms
71,304 KB
testcase_23 AC 74 ms
71,596 KB
testcase_24 AC 72 ms
71,020 KB
testcase_25 RE -
testcase_26 AC 72 ms
71,228 KB
testcase_27 AC 72 ms
71,336 KB
testcase_28 AC 71 ms
71,528 KB
testcase_29 AC 70 ms
71,200 KB
testcase_30 AC 70 ms
71,336 KB
testcase_31 AC 70 ms
71,484 KB
testcase_32 AC 72 ms
71,080 KB
testcase_33 AC 72 ms
71,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def max_taste(N: int, V: list) -> int:
    dp = [0] * N
    dp[0] = V[0]
    dp[1] = max(V[0], V[1])
    for i in range(2, N):
        dp[i] = max(dp[i - 1], dp[i - 2] + V[i])
    return dp[N - 1]
N = int(input())
V = list(map(int, input().split()))
print(max_taste(N, V))
0