結果
問題 |
No.45 回転寿司
|
ユーザー |
![]() |
提出日時 | 2024-02-21 21:29:09 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 35 ms / 5,000 ms |
コード長 | 240 bytes |
コンパイル時間 | 299 ms |
コンパイル使用メモリ | 82,396 KB |
実行使用メモリ | 54,428 KB |
最終ジャッジ日時 | 2024-09-29 04:20:21 |
合計ジャッジ時間 | 2,563 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
N = int(input()) M = 500_001 V = list(map(int, input().split())) dp = [0, V[0], 0] ans = V[0] for i in range(2, N+1): x = i % 3 max_v = max(dp[(x-2) % 3]+V[i-1], dp[(x-1) % 3]) dp[x] = max_v ans = max(ans, max_v) print(ans)