結果

問題 No.45 回転寿司
ユーザー qoiuoyr
提出日時 2020-06-05 15:53:02
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 336 bytes
コンパイル時間 204 ms
コンパイル使用メモリ 82,476 KB
実行使用メモリ 128,712 KB
最終ジャッジ日時 2024-12-16 00:24:30
合計ジャッジ時間 176,003 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 2 TLE * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
v = list(map(int, input().split()))
ans = 0
for ptn in range(1<<n):
    cnt = 0
    k = -1
    for i in range(n):
        bit = ptn >> i & 1
        if bit == k:
            break
        if bit:
            cnt += v[i]
            k = 1
        else:
            k = -1
    else:
        ans = max(ans, cnt)
print(ans)
0