#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> find_subset(int l, int u, vector<int> w){
int n = w.size();
vector<pair<int, int>> dat(n);
for(int i = 0; i < n; i++){
dat[i] = {w[i], i};
}
sort(dat.begin(), dat.end());
ll s1 = dat[0].first;
ll s2 = dat[n-1].first;
int k = 1;
while(k <= n){
if(s1 > u || s2 < l){
k++;
s1 += dat[k-1].first;
s2 += dat[n-k].first;
}else{
vector<int> result(k);
int ind = 0;
for(int i = 0; i < k; i++){
result[i] = dat[i].second;
}
while(s1 < u){
s1 -= dat[ind].first;
s1 += dat[n-ind-1].first;
result[ind] = dat[n-ind-1].second;
ind++;
}
return result;
}
}
return {};
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
504 KB |
OK (n = 3, answer = YES) |
9 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 6 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
0 ms |
344 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
0 ms |
604 KB |
OK (n = 12, answer = NO) |
5 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
6 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 6 |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
504 KB |
OK (n = 3, answer = YES) |
9 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 6 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
504 KB |
OK (n = 3, answer = YES) |
9 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 6 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
504 KB |
OK (n = 3, answer = YES) |
9 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 6 |
10 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
504 KB |
OK (n = 3, answer = YES) |
9 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 6 |
10 |
Halted |
0 ms |
0 KB |
- |