結果

問題 No.45 回転寿司
ユーザー tcltktcltk
提出日時 2021-01-17 04:38:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 254 ms / 5,000 ms
コード長 681 bytes
コンパイル時間 530 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 92,136 KB
最終ジャッジ日時 2023-08-19 10:34:17
合計ジャッジ時間 10,546 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 251 ms
92,032 KB
testcase_01 AC 250 ms
91,968 KB
testcase_02 AC 247 ms
92,132 KB
testcase_03 AC 247 ms
91,720 KB
testcase_04 AC 246 ms
91,864 KB
testcase_05 AC 243 ms
92,040 KB
testcase_06 AC 242 ms
92,004 KB
testcase_07 AC 247 ms
91,964 KB
testcase_08 AC 250 ms
91,884 KB
testcase_09 AC 245 ms
92,008 KB
testcase_10 AC 249 ms
92,060 KB
testcase_11 AC 254 ms
92,044 KB
testcase_12 AC 247 ms
92,028 KB
testcase_13 AC 253 ms
91,768 KB
testcase_14 AC 247 ms
91,716 KB
testcase_15 AC 248 ms
92,048 KB
testcase_16 AC 248 ms
92,060 KB
testcase_17 AC 250 ms
91,968 KB
testcase_18 AC 251 ms
91,640 KB
testcase_19 AC 249 ms
91,860 KB
testcase_20 AC 245 ms
92,032 KB
testcase_21 AC 247 ms
91,984 KB
testcase_22 AC 247 ms
92,032 KB
testcase_23 AC 244 ms
92,008 KB
testcase_24 AC 244 ms
92,020 KB
testcase_25 AC 248 ms
91,872 KB
testcase_26 AC 254 ms
91,720 KB
testcase_27 AC 251 ms
91,640 KB
testcase_28 AC 249 ms
91,972 KB
testcase_29 AC 250 ms
91,836 KB
testcase_30 AC 249 ms
92,032 KB
testcase_31 AC 246 ms
92,136 KB
testcase_32 AC 244 ms
91,960 KB
testcase_33 AC 245 ms
92,032 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