#include <bits/stdc++.h>
#include "molecules.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>> v(n);
vector<int> out;
for(int i = 0; i < n; ++i){
v[i].first = w[i];
v[i].second = i;
}
sort(v.begin(), v.end());
int le = 0, ri = n-1;
int sum = v[n-1].first;
while(le < ri){
while(sum < l && le < ri){
sum+=v[--ri].first;
}
while(sum > u && le < ri){
sum+=v[le].first;
le++;
sum-=v[n-le].first;
}
if(sum <= u && sum >= l){
for(int i = 0; i < le; ++i){
out.push_back(v[i].second);
}
for(int i = n-1-le; i>= ri; --i){
out.push_back(v[i].second);
}
return out;
}
}
return vector<int>(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = NO) |
5 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
6 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
7 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
8 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
9 |
Correct |
0 ms |
256 KB |
OK (n = 6, answer = YES) |
10 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
11 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = NO) |
12 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = NO) |
14 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = YES) |
16 |
Correct |
0 ms |
384 KB |
OK (n = 100, answer = YES) |
17 |
Correct |
0 ms |
372 KB |
OK (n = 100, answer = YES) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |