#include "molecules.h"
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> v2i;
typedef pair<int, int> pi;
typedef vector<pi> vpi;
#define pb push_back
#define mp make_pair
#define rept(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) for (int i = 0; i < (n); i++)
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vpi ms;
int n = w.size();
rep(i, n) ms.pb({ w[i], i });
sort(ms.begin(), ms.end());
ll s = 0;
queue<pi> q;
bool found = true;
for (int i = 0; i < n && (s < l || s > u);) {
if (s < l) {
q.push(ms[i]);
s += ms[i].first;
i++;
}
else {
s -= q.front().first;
q.pop();
}
if (i >= n) found = false;
}
vi res;
res.reserve(n);
if (!found && (s < l || s > u)) return res;
while (!q.empty()) {
res.pb(q.front().second);
q.pop();
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = YES) |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = NO) |
5 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
6 |
Incorrect |
0 ms |
348 KB |
Contestant can not find answer, jury can |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = NO) |
24 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
25 |
Incorrect |
0 ms |
348 KB |
Contestant can not find answer, jury can |
26 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = NO) |
24 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
25 |
Incorrect |
0 ms |
348 KB |
Contestant can not find answer, jury can |
26 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = NO) |
24 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
25 |
Incorrect |
0 ms |
348 KB |
Contestant can not find answer, jury can |
26 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
348 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
0 ms |
348 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
1 ms |
348 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
0 ms |
348 KB |
OK (n = 3, answer = NO) |
18 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = NO) |
19 |
Correct |
0 ms |
348 KB |
OK (n = 100, answer = YES) |
20 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
21 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
22 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = NO) |
23 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = NO) |
24 |
Correct |
0 ms |
348 KB |
OK (n = 12, answer = YES) |
25 |
Incorrect |
0 ms |
348 KB |
Contestant can not find answer, jury can |
26 |
Halted |
0 ms |
0 KB |
- |