結果
問題 | No.393 2本の竹 |
ユーザー |
|
提出日時 | 2021-09-13 20:02:32 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 526 bytes |
コンパイル時間 | 223 ms |
コンパイル使用メモリ | 82,116 KB |
実行使用メモリ | 257,960 KB |
最終ジャッジ日時 | 2024-06-25 20:50:09 |
合計ジャッジ時間 | 13,328 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 TLE * 1 |
ソースコード
def solve():N,M=map(int,input().split())K=int(input())A=list(map(int,input().split()))list.sort(A)maxN=100010dp=[0]*maxNdp[0]=1ans=0cum=0for i in range(K):cum+=A[i]ndp=dp[:]for j in range(maxN):if dp[j] and j+A[i]<maxN:ndp[j+A[i]]=1dp=ndp[:]for j in range(maxN):if dp[j] and j<=N and cum-j<=M:ans=max(ans,i+1)print(ans)d=int(input())while d:solve()d-=1