結果
| 問題 |
No.45 回転寿司
|
| ユーザー |
|
| 提出日時 | 2023-06-19 02:30:13 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 508 bytes |
| コンパイル時間 | 188 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 81,536 KB |
| 最終ジャッジ日時 | 2024-06-26 13:04:33 |
| 合計ジャッジ時間 | 12,751 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | TLE * 1 -- * 29 |
ソースコード
N = int(input())
V = list(map(int, input().split()))
from itertools import combinations
n = [_ for _ in range(N)]
ans = 0
for i in range(1, N+1):
for j in combinations(n, i):
# print(j)
v = 0
judge = True
for k in range(i-1):
if j[k]+1 == j[k+1]:
judge = False
break
else:
v += V[j[k]]
if judge:
v += V[j[-1]]
# print(j,v)
ans = max(ans, v)
print(ans)