結果

問題 No.45 回転寿司
ユーザー Mr.FukuMr.Fuku
提出日時 2018-06-24 22:53:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 66 ms / 5,000 ms
コード長 248 bytes
コンパイル時間 287 ms
コンパイル使用メモリ 87,024 KB
実行使用メモリ 71,548 KB
最終ジャッジ日時 2023-08-27 16:31:33
合計ジャッジ時間 3,582 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,276 KB
testcase_01 AC 63 ms
71,272 KB
testcase_02 AC 63 ms
71,508 KB
testcase_03 AC 64 ms
71,052 KB
testcase_04 AC 62 ms
71,500 KB
testcase_05 AC 64 ms
71,316 KB
testcase_06 AC 62 ms
71,548 KB
testcase_07 AC 64 ms
71,540 KB
testcase_08 AC 62 ms
71,272 KB
testcase_09 AC 63 ms
71,540 KB
testcase_10 AC 63 ms
71,316 KB
testcase_11 AC 64 ms
71,276 KB
testcase_12 AC 64 ms
71,272 KB
testcase_13 AC 62 ms
71,272 KB
testcase_14 AC 63 ms
71,068 KB
testcase_15 AC 64 ms
71,456 KB
testcase_16 AC 65 ms
71,372 KB
testcase_17 AC 61 ms
71,308 KB
testcase_18 AC 63 ms
71,272 KB
testcase_19 AC 63 ms
71,388 KB
testcase_20 AC 63 ms
71,272 KB
testcase_21 AC 64 ms
71,400 KB
testcase_22 AC 63 ms
71,272 KB
testcase_23 AC 60 ms
71,484 KB
testcase_24 AC 61 ms
71,280 KB
testcase_25 AC 62 ms
71,316 KB
testcase_26 AC 63 ms
71,312 KB
testcase_27 AC 63 ms
71,264 KB
testcase_28 AC 66 ms
71,156 KB
testcase_29 AC 62 ms
71,268 KB
testcase_30 AC 63 ms
71,316 KB
testcase_31 AC 64 ms
71,392 KB
testcase_32 AC 65 ms
71,476 KB
testcase_33 AC 63 ms
71,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
lst = list(map(int,input().split()))

if n>=3:
    lst2 = [lst[0],max(lst[0],lst[1])]
    for i in range(2,n):
        mx = max(lst2[i-2]+lst[i],lst2[i-1])
        lst2.append(mx)
    print(max(lst2[-2:]))
else:
    print(max(lst))
0