結果

問題 No.45 回転寿司
ユーザー tcltktcltk
提出日時 2021-01-17 04:20:56
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 642 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 9,632 KB
最終ジャッジ日時 2023-08-19 10:31:31
合計ジャッジ時間 2,669 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
9,536 KB
testcase_01 AC 26 ms
9,372 KB
testcase_02 AC 25 ms
9,436 KB
testcase_03 AC 26 ms
9,632 KB
testcase_04 AC 26 ms
9,544 KB
testcase_05 AC 25 ms
9,360 KB
testcase_06 AC 25 ms
9,592 KB
testcase_07 AC 25 ms
9,520 KB
testcase_08 AC 25 ms
9,340 KB
testcase_09 AC 25 ms
9,452 KB
testcase_10 AC 25 ms
9,484 KB
testcase_11 AC 25 ms
9,372 KB
testcase_12 AC 26 ms
9,604 KB
testcase_13 AC 26 ms
9,504 KB
testcase_14 AC 25 ms
9,492 KB
testcase_15 AC 26 ms
9,360 KB
testcase_16 AC 25 ms
9,576 KB
testcase_17 AC 26 ms
9,480 KB
testcase_18 AC 26 ms
9,372 KB
testcase_19 AC 26 ms
9,520 KB
testcase_20 AC 25 ms
9,352 KB
testcase_21 AC 25 ms
9,316 KB
testcase_22 AC 25 ms
9,332 KB
testcase_23 AC 25 ms
9,336 KB
testcase_24 AC 25 ms
9,496 KB
testcase_25 AC 25 ms
9,336 KB
testcase_26 AC 25 ms
9,388 KB
testcase_27 AC 26 ms
9,512 KB
testcase_28 AC 25 ms
9,560 KB
testcase_29 AC 26 ms
9,612 KB
testcase_30 AC 25 ms
9,592 KB
testcase_31 AC 25 ms
9,368 KB
testcase_32 AC 26 ms
9,336 KB
testcase_33 AC 26 ms
9,424 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