結果
問題 |
No.45 回転寿司
|
ユーザー |
![]() |
提出日時 | 2024-02-21 21:07:17 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
MLE
|
実行時間 | - |
コード長 | 395 bytes |
コンパイル時間 | 786 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 817,100 KB |
最終ジャッジ日時 | 2024-09-29 04:19:43 |
合計ジャッジ時間 | 2,894 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 4 |
other | MLE * 1 -- * 29 |
ソースコード
N = int(input()) M = 500_001 V = list(map(int, input().split())) dp = [[False]*M for _ in range(N+1)] dp[0][0] = dp[1][0] = dp[1][V[0]] = True ans = V[0] for i in range(2, N+1): v = V[i-1] for j in range(M): if v <= j: dp[i][j] = dp[i-2][j-v] or dp[i-1][j] else: dp[i][j] = dp[i-1][j] if dp[i][j]: ans = max(ans, j) print(ans)