結果

問題 No.45 回転寿司
ユーザー tachyon777tachyon777
提出日時 2020-02-13 13:41:13
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 41 ms / 5,000 ms
コード長 269 bytes
コンパイル時間 341 ms
コンパイル使用メモリ 82,376 KB
実行使用メモリ 53,896 KB
最終ジャッジ日時 2024-04-15 17:34:03
合計ジャッジ時間 2,599 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,112 KB
testcase_01 AC 39 ms
53,160 KB
testcase_02 AC 40 ms
53,572 KB
testcase_03 AC 41 ms
53,568 KB
testcase_04 AC 39 ms
53,048 KB
testcase_05 AC 39 ms
52,368 KB
testcase_06 AC 40 ms
52,220 KB
testcase_07 AC 40 ms
53,004 KB
testcase_08 AC 39 ms
53,404 KB
testcase_09 AC 39 ms
53,896 KB
testcase_10 AC 40 ms
52,624 KB
testcase_11 AC 39 ms
52,072 KB
testcase_12 AC 38 ms
52,828 KB
testcase_13 AC 38 ms
52,392 KB
testcase_14 AC 39 ms
52,428 KB
testcase_15 AC 39 ms
53,300 KB
testcase_16 AC 38 ms
52,544 KB
testcase_17 AC 39 ms
53,228 KB
testcase_18 AC 40 ms
52,456 KB
testcase_19 AC 39 ms
52,548 KB
testcase_20 AC 39 ms
52,068 KB
testcase_21 AC 39 ms
52,072 KB
testcase_22 AC 38 ms
52,684 KB
testcase_23 AC 39 ms
52,000 KB
testcase_24 AC 39 ms
52,352 KB
testcase_25 AC 38 ms
52,424 KB
testcase_26 AC 39 ms
52,200 KB
testcase_27 AC 39 ms
52,648 KB
testcase_28 AC 39 ms
53,012 KB
testcase_29 AC 40 ms
53,736 KB
testcase_30 AC 39 ms
53,132 KB
testcase_31 AC 39 ms
51,888 KB
testcase_32 AC 39 ms
52,156 KB
testcase_33 AC 39 ms
53,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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])
0