結果
問題 |
No.45 回転寿司
|
ユーザー |
|
提出日時 | 2022-12-04 10:07:55 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 31 ms / 5,000 ms |
コード長 | 292 bytes |
コンパイル時間 | 548 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-10-11 09:56:23 |
合計ジャッジ時間 | 2,600 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
N = int(input()) V = [int(i) for i in input().split()] if N == 1: print(V[0]) exit(0) if N == 2: print(max(V[0], V[1])) exit(0) S = [V[0], V[1], V[2] + V[0]] for i in range(3, N): tmp = max(S[i - 2], S[i - 3]) S.append(tmp + V[i]) print(max(S[N - 1], S[N - 2]))