#include <bits/stdc++.h>
using namespace std;
long long sum, n, kezd=-1, veg;
vector<pair<long long, int> >sz;
vector<int> ans;
void add(int a, int b) {
sum+=b*sz[a].first;
}
vector<int> find_subset(int a, int b, vector<int> w) {
n=w.size(), veg=n;
for (int i=0; i<n; i++) {
sz.push_back({w[i], i});
}
sort(sz.rbegin(), sz.rend());
while(kezd+1<n && sum<a) {
kezd++;
add(kezd, 1);
}
if (a<=sum && sum<=veg) {
for (int i=0; i<=kezd; i++) ans.push_back(sz[i].second);
return ans;
}
while(kezd>=0 && sum>b) {
add(kezd, -1), kezd--;
veg--, add(veg, 1);
if (a<=sum && sum<=b) {
for (int i=0; i<=kezd; i++) ans.push_back(sz[i].second);
for (int i=veg; i<n; i++) ans.push_back(sz[i].second);
return ans;
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = NO) |
5 |
Correct |
0 ms |
256 KB |
OK (n = 12, answer = YES) |
6 |
Incorrect |
1 ms |
256 KB |
Contestant can not find answer, jury can |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
0 ms |
256 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |