#include "molecules.h"
#include <cstdio>
#include <iostream>
#include <algorithm>
#define F first
#define S second
#define N 200005
using namespace std;
typedef long long ll;
vector<int> ans;
ll n, v[N];
pair<ll, ll> a[N];
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
ll i, j, s, en, r = u;
n = w.size();
for (i =0; i <n; i++) {
a[i].F = w[i];
a[i].S = i;
}
sort(a, a + n);
s = 0;
for (i =0; i< n; i++) {
if (s + a[i].F <= r) {s += a[i].F; v[a[i].S] = 1;}
else break;
}
en = i;
for (i = 0, j = en; i < en && j < n && s < l; i++, j++) {
s -= a[i].F;
s += a[j].F;
v[a[i].S] = 0;
v[a[j].S] = 1;
}
for (i =0; i < n; i++) if (v[i]) ans.push_back(i);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 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 |
Correct |
1 ms |
384 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
1 ms |
288 KB |
OK (n = 12, answer = YES) |
3 |
Incorrect |
1 ms |
384 KB |
sum of weights should be in [307..317] but it is 306 |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 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 |
1 ms |
384 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 |
1 ms |
384 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 |
1 ms |
384 KB |
sum of weights should be in [10..12] but it is 9 |
2 |
Halted |
0 ms |
0 KB |
- |