#include "molecules.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector<pair<int, int>> a;
for(int i=0;i<n;i++){
a.push_back({w[i], i});
}
sort(a.begin(), a.end());
vector<int> ans;
int sum = 0;
//cout << mn << ' ' ;
for(auto x : w)sum += x;
if(sum < l)return ans;
sum = 0;
for(int i=n-1;i>=0;i--){
// cout << a[i].first << ' ';
while(i >= 0 && a[i].first+sum > u)i--;
if(i == -1)break;
sum += a[i].first;
ans.push_back(a[i].second);
}
// cout << sum << ' ';
if(sum < l)ans.clear();
return ans;
}
/*
4 15 17
6 8 8 7
4 14 15
5 5 6 6
4 10 20
15 17 16 18
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 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 |
1 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 |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = YES) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 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 |
1 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 |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 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 |
1 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 |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 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 |
1 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 |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 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 |
1 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 |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
1 ms |
256 KB |
OK (n = 100, answer = YES) |
20 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
21 |
Halted |
0 ms |
0 KB |
- |