#include <algorithm>
#include "molecules.h"
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<int> V;
int N=w.size();
int S=0;
vector<pair<int,int>> W;
for(int i=0;i<N;i++)
W.push_back({w[i],i});
sort(W.begin(), W.end());
for(int a=0,b=0;a<N;a++){
S-=a?W[a-1].first:0;
while(l>S and b<N)
S+=W[b++].first;
if(b<N and S<=u){
for(int i=a;i<b;i++)
V.push_back(W[i].second);
return V;
}
}
return V;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
4 ms |
368 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
4 ms |
436 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
436 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
3 ms |
436 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
3 ms |
436 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
3 ms |
436 KB |
OK (n = 12, answer = NO) |
5 |
Correct |
2 ms |
496 KB |
OK (n = 12, answer = YES) |
6 |
Incorrect |
3 ms |
616 KB |
Contestant can not find answer, jury can |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
4 ms |
368 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
4 ms |
436 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
4 ms |
368 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
4 ms |
436 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
4 ms |
368 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
4 ms |
436 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
4 ms |
368 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
4 ms |
436 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |