結果
| 問題 | No.45 回転寿司 |
| ユーザー |
tachyon777
|
| 提出日時 | 2020-02-13 13:41:13 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 25 ms / 5,000 ms |
| コード長 | 269 bytes |
| 記録 | |
| コンパイル時間 | 254 ms |
| コンパイル使用メモリ | 85,504 KB |
| 実行使用メモリ | 52,736 KB |
| 最終ジャッジ日時 | 2026-04-21 05:06:21 |
| 合計ジャッジ時間 | 2,069 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 30 |
ソースコード
n = int(input())
lst1 = list(map(int,input().split()))
dp = [0]*n
dp[0] = lst1[0]
if n == 1:
print(dp[-1])
exit()
dp[1] = max(lst1[0],lst1[1])
if n == 2:
print(dp[-1])
exit()
for i in range(1,n):
dp[i] = max(dp[i-1],dp[i-2]+lst1[i])
print(dp[-1])
tachyon777