#include <bits/stdc++.h>
#include <molecules.h>
using namespace std;
using ll = long long;
// u - l >= wmax - wmin
// what does this mean for me
vector<int> find_subset(int l, int u, vector<int> w){
int n=w.size();
sort(w.begin(), w.end());
assert(*(w.rbegin()) - *(w.begin()) <= u - l);
vector<int> ret;
if(u < w[0]){
return ret;
}
ll sum = 0;
for(int i = n-1; i >= 1; i--){
sum += w[i];
if(sum > u){
sum -= w[i];
sum += w[0];
if(sum >= l && sum <= u){
for(int j = n-1; j > i; j--){
ret.push_back(j);
}
ret.push_back(0);
return ret;
}
}
else if(sum >= l){
for(int j = n-1; j >= i; j--){
ret.push_back(j);
}
return ret;
}
}
sum += w[0];
if(sum >= l && sum <= u){
for(int i =0; i < n; i++){
ret.push_back(i);
}
return ret;
}
else{
return ret;
}
}
// int main(){
// int l = 10;
// int u = 20;
// vector<int> w = {15, 17, 16, 18};
// vector<int> ret = find_subset(l, u, w);
// for(int x : ret){
// cout << x << " ";
// }
// cout << endl;
// }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
384 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
384 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = YES) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
256 KB |
Contestant can not find answer, jury can |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
384 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
384 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
0 ms |
256 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
384 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
384 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
0 ms |
256 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
384 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
384 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
0 ms |
256 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
384 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
384 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
0 ms |
256 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |