結果

問題 No.45 回転寿司
ユーザー tcltktcltk
提出日時 2021-01-17 04:17:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 160 ms / 5,000 ms
コード長 681 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 82,520 KB
実行使用メモリ 89,472 KB
最終ジャッジ日時 2024-05-06 17:46:19
合計ジャッジ時間 6,889 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 160 ms
89,228 KB
testcase_01 AC 157 ms
89,088 KB
testcase_02 AC 150 ms
89,088 KB
testcase_03 AC 151 ms
89,088 KB
testcase_04 AC 148 ms
89,216 KB
testcase_05 AC 147 ms
89,216 KB
testcase_06 AC 148 ms
89,216 KB
testcase_07 AC 154 ms
89,240 KB
testcase_08 AC 151 ms
89,216 KB
testcase_09 AC 149 ms
89,216 KB
testcase_10 AC 152 ms
89,088 KB
testcase_11 AC 148 ms
88,920 KB
testcase_12 AC 149 ms
89,088 KB
testcase_13 AC 146 ms
89,088 KB
testcase_14 AC 149 ms
89,088 KB
testcase_15 AC 154 ms
89,472 KB
testcase_16 AC 148 ms
89,088 KB
testcase_17 AC 152 ms
89,088 KB
testcase_18 AC 149 ms
89,088 KB
testcase_19 AC 153 ms
89,216 KB
testcase_20 AC 149 ms
89,088 KB
testcase_21 AC 151 ms
89,192 KB
testcase_22 AC 153 ms
89,404 KB
testcase_23 AC 152 ms
89,088 KB
testcase_24 AC 155 ms
88,704 KB
testcase_25 AC 154 ms
88,832 KB
testcase_26 AC 151 ms
89,088 KB
testcase_27 AC 150 ms
88,824 KB
testcase_28 AC 155 ms
88,960 KB
testcase_29 AC 151 ms
88,960 KB
testcase_30 AC 150 ms
89,192 KB
testcase_31 AC 147 ms
88,704 KB
testcase_32 AC 145 ms
89,088 KB
testcase_33 AC 145 ms
88,832 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
from queue import PriorityQueue
import bisect
import heapq

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

# _INPUT = """# paste here...
# """
# sys.stdin = io.StringIO(_INPUT)


def main():
    N = int(input())
    V = list(map(int, input().split()))

    dp = [0 for _ in range(N+1)]
    dp[0] = 0
    dp[1] = V[0]
    for i in range(2, N+1):
        dp[i] = max(dp[i-2] + V[i-1], dp[i-1])
    print(dp[N])


if __name__ == '__main__':
    main()
0