#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int N, L, U;
vector<int> W;
bitset<1000> INF;
bitset<1000> DP(int i, int sum, bitset<1000> choosen) {
if (sum>U) return INF;
if (sum>=L) return choosen;
if (i == N) return INF;
bitset<1000> res1, res2, res;
choosen[i] = 1;
res1 = DP(i+1, sum + W[i], choosen);
choosen[i] = 0;
res2 = DP(i+1, sum, choosen);
if (res1.count()>res2.count()) res = res1;
else res = res2;
return res;
}
vector<int> find_subset(int l, int u, vector<int> w) {
N = w.size(); L = l; U = u; W = w;
bitset<1000> res = DP(0,0, INF);
vector<int> Ans(res.count());
for (int i = 0, j = 0; i<N; ++i) {
if (res[i]) {
Ans[j] = i;
++j;
}
}
return Ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Execution timed out |
1097 ms |
384 KB |
Time limit exceeded |
19 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
2 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
3 |
Correct |
2 ms |
256 KB |
OK (n = 12, answer = NO) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = NO) |
5 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
6 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
7 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
8 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
9 |
Correct |
1 ms |
372 KB |
OK (n = 6, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 12, answer = YES) |
11 |
Execution timed out |
1091 ms |
384 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Execution timed out |
1097 ms |
384 KB |
Time limit exceeded |
19 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Execution timed out |
1097 ms |
384 KB |
Time limit exceeded |
19 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Execution timed out |
1097 ms |
384 KB |
Time limit exceeded |
19 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
0 ms |
256 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
1 ms |
256 KB |
OK (n = 1, answer = YES) |
4 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
5 |
Correct |
1 ms |
256 KB |
OK (n = 2, answer = YES) |
6 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
7 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
8 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
9 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
10 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
11 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
12 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
13 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
14 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = YES) |
15 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = YES) |
16 |
Correct |
0 ms |
256 KB |
OK (n = 3, answer = NO) |
17 |
Correct |
1 ms |
256 KB |
OK (n = 3, answer = NO) |
18 |
Execution timed out |
1097 ms |
384 KB |
Time limit exceeded |
19 |
Halted |
0 ms |
0 KB |
- |