#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(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 |
Incorrect |
3 ms |
256 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
360 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
3 ms |
564 KB |
OK (n = 12, answer = YES) |
3 |
Incorrect |
2 ms |
584 KB |
sum of weights should be in [307..317] but it is 306 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
256 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
256 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
256 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
256 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |