結果

問題 No.45 回転寿司
ユーザー 1235486527
提出日時 2019-11-27 13:13:04
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 505 bytes
コンパイル時間 376 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-11-08 02:07:47
合計ジャッジ時間 2,465 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 2 WA * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
V = tuple(map(int, input().split()))
s = 0
e = False

if N > 2:
    for i in range(N-1, 1, -1):
        if e:
            if V[i-2] > V[i-1]:
                e = True
            else:
                e = False
        else:
            if V[i] + V[i-2] > V[i-1]:
                s += V[i]
                e = True
            else:
                e = False
    else:
        if e:
            s += V[0]
        else:
            s += max(V[0], V[1])
    print(s)
else:
    print(max(V))
0