#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
//return std::vector<int>(0);
int leva=-1, desna=-1;
vector<int>ans;
//sort(w.begin(), w.end());
int n = w.size();
vector<int>pref(n+5, 0);
for(int i = 1; i<=n; i++)pref[i]=pref[i-1]+w[i-1];
for(int i = 1; i<=n; i++)
{
auto g = upper_bound(pref.begin(),pref.end(), pref[i]-l) - pref.begin();
if(g==0)continue;
if(pref[i]-pref[g-1]<=u)
{
leva = g;
desna = i;
break;
}
}
if(leva==-1 && desna==-1)
return vector<int>(0);
else
{
for(int i = leva; i<=desna; i++)ans.push_back(w[i-1]);
return ans;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
348 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Integer 50 violates the range [0, 11] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
348 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
348 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
348 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Incorrect |
1 ms |
348 KB |
Contestant can not find answer, jury can |
4 |
Halted |
0 ms |
0 KB |
- |