#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(cur == n) continue;
if(prefix[cur + 1] - remove > u) continue;
for(int j = i; j <= cur; j++) ans.push_back(W[j].second);
return ans;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
380 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
3 ms |
380 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
3 ms |
416 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
468 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
3 ms |
492 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
2 ms |
492 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
3 ms |
492 KB |
OK (n = 12, answer = NO) |
5 |
Correct |
2 ms |
556 KB |
OK (n = 12, answer = YES) |
6 |
Correct |
3 ms |
556 KB |
OK (n = 12, answer = YES) |
7 |
Correct |
2 ms |
556 KB |
OK (n = 12, answer = YES) |
8 |
Correct |
3 ms |
556 KB |
OK (n = 12, answer = YES) |
9 |
Correct |
3 ms |
556 KB |
OK (n = 6, answer = YES) |
10 |
Correct |
4 ms |
556 KB |
OK (n = 12, answer = YES) |
11 |
Correct |
3 ms |
588 KB |
OK (n = 100, answer = NO) |
12 |
Correct |
3 ms |
588 KB |
OK (n = 100, answer = YES) |
13 |
Correct |
3 ms |
588 KB |
OK (n = 100, answer = NO) |
14 |
Correct |
3 ms |
588 KB |
OK (n = 100, answer = YES) |
15 |
Correct |
3 ms |
588 KB |
OK (n = 100, answer = YES) |
16 |
Correct |
3 ms |
588 KB |
OK (n = 100, answer = YES) |
17 |
Correct |
3 ms |
588 KB |
OK (n = 100, answer = YES) |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
380 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
3 ms |
380 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
3 ms |
416 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
380 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
3 ms |
380 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
3 ms |
416 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
380 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
3 ms |
380 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
3 ms |
416 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
380 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
3 ms |
380 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
3 ms |
416 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |