結果

問題 No.45 回転寿司
ユーザー CsTarepanda
提出日時 2017-05-04 19:06:56
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 231 bytes
コンパイル時間 101 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 17,312 KB
最終ジャッジ日時 2024-09-14 07:12:13
合計ジャッジ時間 12,781 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 4
other TLE * 1 -- * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))

def solve(d, i, w):
    if -1 < i - 2 < n:
        w += a[i - 2]

    if i >= n:
        return w

    return max(solve(i, i + 2, w), solve(i, i + 3, w))

print(solve(0, 0, 0))
0