結果
| 問題 | No.393 2本の竹 |
| コンテスト | |
| ユーザー |
srup٩(๑`н´๑)۶
|
| 提出日時 | 2016-07-12 01:43:54 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 591 bytes |
| 記録 | |
| コンパイル時間 | 417 ms |
| コンパイル使用メモリ | 82,788 KB |
| 実行使用メモリ | 9,844 KB |
| 最終ジャッジ日時 | 2026-09-17 12:25:34 |
| 合計ジャッジ時間 | 2,190 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 WA * 26 |
ソースコード
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int main(void){
int d; cin >> d;
while(d > 0){
int n1, n2; cin >> n1 >> n2;
int m; cin >> m;
vector<int> a(m);
rep(i, m) cin >> a[i];
sort(a.begin(), a.end());
int mi = min(n1, n2);
int ma = max(n1, n2);
int cnt = 0, ans = 0;
while(mi > 0){
mi -= a[cnt];
if(mi >= 0){
ans++; cnt++;
}
}
while(ma > 0){
ma -= a[cnt];
if(ma >= 0){
ans++; cnt++;
}
}
printf("%d\n", ans);
d--;
}
}
srup٩(๑`н´๑)۶