#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
int sum = 0;
vector<pair<int,int>> vec;
for (int i = 0; i < n; ++i) {
sum += w[i];
vec.push_back({w[i], i + 1});
}
sort(vec.begin(), vec.end(), greater<pair<int,int>>());
while (sum > u && vec.size()) {
sum -= vec.back().first;
vec.pop_back();
}
if (sum > u || sum < l) {
return {};
}
else {
vector<int> ans;
for (auto p : vec) {
ans.push_back(p.second);
}
return ans;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
212 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
212 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Contestant can not find answer, jury can |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
212 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
212 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
212 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
212 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
212 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
212 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
212 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
212 KB |
Integer 1 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |