結果

問題 No.3670 Fast Knapsack
コンテスト
ユーザー 回転
提出日時 2026-09-04 22:45:36
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 2,389 ms / 2,500 ms
+ 785µs
コード長 300 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,808 ms
コンパイル使用メモリ 95,700 KB
実行使用メモリ 109,488 KB
最終ジャッジ日時 2026-09-04 22:55:37
合計ジャッジ時間 40,112 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys
sys.set_int_max_str_digits(10**6)
T = int(input())
for _ in range(T):
    N,S = list(map(int,input().split()))
    A = list(map(int,input().split()))

    can = 1
    MASK = (1<<(S+1)) - 1
    for i in range(N):
        can |= can<<A[i]
        can &= MASK

    print(can.bit_length() - 1)
0