#include <bits/stdc++.h>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<int> ans;
vector<pair<int, int>> W;
int n = (int)w.size();
for(int i = 0; i < n; i++) W.push_back({w[i], i});
sort(W.begin(), W.end());
vector<long long> prefix(n+1);
prefix[0] = 0;
for(int i = 1; i <= n; i++) prefix[i] = prefix[i-1] + (long long)W[i-1].first;
for(int i = 0; i < n; i++) {
long long remove = prefix[i];
if(prefix[n] - remove < l) continue;
int cur = i;
for(int jump = 20; jump >= 0; jump--)
if((1 << jump) + cur < n and prefix[(1 << jump) + cur + 1] - remove < l)
cur += (1 << jump);
cur++;
if(prefix[cur + 1] - remove > u) continue;
for(int j = i; j <= cur; j++) ans.push_back(W[j].second);
return ans;
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Incorrect |
3 ms |
376 KB |
Integer 2 violates the range [0, 1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
572 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
2 ms |
572 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
3 ms |
572 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
2 ms |
572 KB |
OK (n = 12, answer = NO) |
5 |
Correct |
3 ms |
572 KB |
OK (n = 12, answer = YES) |
6 |
Correct |
4 ms |
572 KB |
OK (n = 12, answer = YES) |
7 |
Correct |
2 ms |
572 KB |
OK (n = 12, answer = YES) |
8 |
Correct |
3 ms |
600 KB |
OK (n = 12, answer = YES) |
9 |
Correct |
3 ms |
600 KB |
OK (n = 6, answer = YES) |
10 |
Correct |
3 ms |
600 KB |
OK (n = 12, answer = YES) |
11 |
Correct |
4 ms |
600 KB |
OK (n = 100, answer = NO) |
12 |
Correct |
3 ms |
600 KB |
OK (n = 100, answer = YES) |
13 |
Correct |
2 ms |
600 KB |
OK (n = 100, answer = NO) |
14 |
Correct |
3 ms |
640 KB |
OK (n = 100, answer = YES) |
15 |
Correct |
3 ms |
640 KB |
OK (n = 100, answer = YES) |
16 |
Correct |
3 ms |
640 KB |
OK (n = 100, answer = YES) |
17 |
Correct |
3 ms |
640 KB |
OK (n = 100, answer = YES) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Incorrect |
3 ms |
376 KB |
Integer 2 violates the range [0, 1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Incorrect |
3 ms |
376 KB |
Integer 2 violates the range [0, 1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Incorrect |
3 ms |
376 KB |
Integer 2 violates the range [0, 1] |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Incorrect |
3 ms |
376 KB |
Integer 2 violates the range [0, 1] |
3 |
Halted |
0 ms |
0 KB |
- |