結果
| 問題 |
No.393 2本の竹
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-07-12 00:37:12 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 783 bytes |
| コンパイル時間 | 1,416 ms |
| コンパイル使用メモリ | 163,676 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 18:17:14 |
| 合計ジャッジ時間 | 3,335 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 RE * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
template<class T1, class T2> bool chmin(T1 &a, T2 b) { if (b < a) { a = b; return true; } return false; }
template<class T1, class T2> bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return true; } return false; }
void solve() {
int n1, n2;
cin >> n1 >> n2;
int m;
cin >> m;
vector<int> a(m);
for (int i = 0; i < m; i++) cin >> a[i];
sort(a.begin(), a.end());
int ans = 0;
for (int i = 0; i <= m; i++) {
bitset<100100> dp;
dp[0] = 1;
int sum = 0;
for (int j = 0; j < i; j++) {
sum += a[j];
dp |= dp << a[j];
}
for (int j = 0; j <= sum; j++) {
int k = sum - j;
if (dp[j] && j <= n1 && k <= n2) {
ans = i;
}
}
}
cout << ans << endl;
}
int main() {
int d;
cin >> d;
while (d--) solve();
}