結果
| 問題 | No.3670 Fast Knapsack |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-23 18:04:16 |
| 言語 | PyPy3 (7.3.23 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 326 bytes |
| 記録 | |
| コンパイル時間 | 66 ms |
| コンパイル使用メモリ | 80,976 KB |
| 実行使用メモリ | 119,744 KB |
| 最終ジャッジ日時 | 2026-09-23 18:04:42 |
| 合計ジャッジ時間 | 25,303 ms |
|
ジャッジサーバーID (参考情報) |
judge4_1 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 10 TLE * 2 -- * 13 |
ソースコード
def solve():
n, s = map(int, input().split())
a = list(map(int, input().split()))
f = (1<<(s+1))-1
dp = 1
for i in range(n):
dp |= (dp<<a[i])
dp &= f
for i in range(s, -1, -1):
if dp>>i&1:
print(i)
return
t = int(input())
for _ in range(t):
solve()