#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> ans;
vector<int> find_subset(int l, int u, vector<int> w) {
sort(w.begin(), w.end());
int min = w[0];
int idx = 0, N = w.size();
for(idx = 1; idx <= N; idx++){
if(l < (min * idx)){
break;
}
}
int sliding = 0;
if(idx > 1){
for(int i = 0; i < idx-1; i++){
sliding += w[i];
}
if(l <= sliding && sliding <= u){
for(int j = 0; j < idx-1; j++){
ans.push_back(w[j]);
}
return ans;
}else{
// cout << sliding << "\n";
int i = idx-1;
while(i < N){
sliding += w[i] - w[i-idx+1];
if(l <= sliding && sliding <= u){
for(int j = i - idx + 2; j <= i; j++){
ans.push_back(w[j]);
}
return ans;
}
i++;
}
}
}
for(int i = 0; i < idx; i++){
sliding += w[i];
}
if(l <= sliding && sliding <= u){
for(int j = 0; j < idx; j++){
ans.push_back(w[j]);
}
return ans;
}else{
int i = idx;
while(i < N){
sliding += w[i] - w[i-idx];
if(l <= sliding && sliding <= u){
for(int j = i - idx + 1; j <= i; j++){
ans.push_back(w[j]);
}
return ans;
}
i++;
}
}
return vector<int>(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
376 KB |
Integer 10 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Integer 50 violates the range [0, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
376 KB |
Integer 10 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
376 KB |
Integer 10 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
376 KB |
Integer 10 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
2 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
2 ms |
376 KB |
Integer 10 violates the range [0, 0] |
4 |
Halted |
0 ms |
0 KB |
- |