#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<int> find_subset(int l, int u, vector<int> w) {
int N = w.size();
pair<int,int> A[N-1];
for (int i = 0; i<N; ++i) {
A[i].first = w[i]; A[i].second = i;
}
sort(A, A);
ll prefix[N]; prefix[0] = 0;
for (int i = 1; i<=N; ++i) prefix[i] = prefix[i-1] + A[i-1].first;
int i = 0, j = 1;
while (true) {
if (prefix[j]-prefix[i]<l) {
++j;
if (j>N) break;
}
else if (prefix[j]-prefix[i]>u) {
++i;
while (i>=j) {
++j;
if (j>N) break;
}
}
else {
vector<int> Ans(j-i);
int k = 0;
while(i<=j) {
++i;
Ans[k] = A[i].second;
}
return Ans;
}
}
return {0};
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 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 |
0 ms |
256 KB |
item #0 is taken twice |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 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 |
2 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 |
2 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 |
2 ms |
256 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |