結果

問題 No.45 回転寿司
ユーザー idkqh7
提出日時 2014-10-19 16:13:31
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 386 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-24 07:14:00
合計ジャッジ時間 2,116 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 1 WA * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

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

if N < 2:
    print(V[0])
else:
    yummy = [0] * int(N/2)
    yummy[0] = max(V[0], V[1])
    j = 1
    for i in range(3, N, 2):
        yummy[j] = yummy[j-1] + max(V[i], V[i-1])
        j += 1
    j -= 1
    if N % 2 == 1:
        if V[N-2] < V[N-1]:
            yummy[j] = yummy[j-1] + V[N-1]

    print(yummy[j])
0