結果
問題 | No.50 おもちゃ箱 |
ユーザー |
![]() |
提出日時 | 2024-11-10 14:10:53 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 441 bytes |
コンパイル時間 | 1,886 ms |
コンパイル使用メモリ | 170,472 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-10 14:10:57 |
合計ジャッジ時間 | 3,632 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 4 |
other | WA * 38 |
ソースコード
#include<bits/stdc++.h> using namespace std; int a[1005]; int main(){ int T; scanf("%d",&T); while(T--){ int n1,n2,m; scanf("%d%d%d",&n1,&n2,&m); for(int i=1;i<=m;++i)scanf("%d",&a[i]); sort(a+1,a+m+1); bitset<100005>bs; bs[1]=1; int ans=0,he=0; for(int i=1;i<=m;++i){ bs|=bs<<a[i];he+=a[i]; if(he>n1+n2)break; if((signed)bs._Find_next(max(0,he-n2))>n1+1)break; ans=i; } printf("%d\n",ans); } return 0; }