結果

問題 No.45 回転寿司
ユーザー howakuro
提出日時 2018-12-02 01:46:25
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
RE  
実行時間 -
コード長 560 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 496 ms
コンパイル使用メモリ 20,828 KB
実行使用メモリ 21,088 KB
最終ジャッジ日時 2026-03-14 14:45:41
合計ジャッジ時間 7,733 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16 RE * 14
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def memorize(f):
    cache = {}
    def helper(x, y):
        if (x, y) not in cache:
            cache[(x, y)] = f(x, y)
        return cache[(x, y)]
    return helper

memo = {}
@memorize
def kaitenzusi(susi_number,before_get):
    if susi_number == N:
        return 0
    not_get = 0 
    if before_get == False:
        not_get = kaitenzusi(susi_number+1, True) + V[susi_number]
    get = kaitenzusi(susi_number+1, False) 
    return not_get if not_get > get else get

N = int(input())
V = [int(num) for num in input().split()]
print(kaitenzusi(0, False))
0