#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
356 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
392 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
468 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
2 ms |
468 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
3 ms |
468 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
2 ms |
468 KB |
OK (n = 12, answer = NO) |
5 |
Incorrect |
2 ms |
552 KB |
Contestant can not find answer, jury can |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
356 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
392 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
356 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
392 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
356 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
392 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
248 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
356 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
392 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |