結果
| 問題 | No.45 回転寿司 |
| ユーザー |
CsTarepanda
|
| 提出日時 | 2017-05-04 01:04:40 |
| 言語 | Python3 (3.14.3 + numpy 2.4.4 + scipy 1.17.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 347 bytes |
| 記録 | |
| コンパイル時間 | 350 ms |
| コンパイル使用メモリ | 20,700 KB |
| 実行使用メモリ | 649,764 KB |
| 最終ジャッジ日時 | 2026-04-04 11:07:50 |
| 合計ジャッジ時間 | 13,022 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 4 |
| other | WA * 2 MLE * 2 -- * 26 |
ソースコード
n = int(input())
a = list(map(int, input().split()))
dp = [{} for x in range(n)]
def solve(i, w, get):
if i >= n:
return w
if dp[i].get(w):
return dp[i][w]
dp[i][w] = w
if get:
return solve(i + 1, w, False)
return max(solve(i + 1, w, False), solve(i + 1, w + a[i], True))
print(solve(0, 0, False))
CsTarepanda