#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 N = w.size();
long long sum = w[0];
int low = N-1, up = N-1;
while((sum < l || sum > u) && low >= 0){
while(sum < l && up >= low){
up--;
sum += w[up];
}
while(sum > u && low >= 0){
sum -= w[low];
low--;
}
// cout << low << " " << up << " " << sum << "\n";
}
if(l <= sum && sum <= u){
for(int i = low; i <= up; i++){
ans.push_back(w[i]);
}
return ans;
}
return vector<int>(0);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1076 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1079 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1076 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1076 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1076 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1076 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |