結果

問題 No.45 回転寿司
ユーザー Mario
提出日時 2018-05-20 02:19:10
言語 Python3
(3.14.3 + numpy 2.4.4 + scipy 1.17.1)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
MLE  
実行時間 -
コード長 684 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 363 ms
コンパイル使用メモリ 20,628 KB
実行使用メモリ 1,307,768 KB
最終ジャッジ日時 2026-03-17 10:53:49
合計ジャッジ時間 178,793 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample MLE * 4
other AC * 2 TLE * 4 MLE * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

routes = [[1]]
flag = True

ans = []

while flag:

    flag = False
    r = []

    for route in routes:

        if route == []:
            continue

        if route[-1] < n:
            r.append(route + [route[-1] + 2])
            r.append(route[:-1] + [route[-1] + 1])
            flag = True
        elif route[-1] == n:
            ans.append(route)
            ans.append(route[:-1])
        else:
            ans.append(route[:-1])

    if flag == True:
        routes = r

else:

    score = []

    for a in ans:
        s = 0
        for i in a:
            s += v[i-1]
        score.append(s)

    print(max(score))
0