// #include "molecules.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<int> result;
int n = w.size();
bitset<100> dp[n + 1] = {};
dp[0][0] = 1;
for(int i = 0; i < n; i++) {
dp[i + 1] |= (dp[i] << w[i]);
dp[i + 1] |= (dp[i]);
}
for(int i = l; i <= u; i++) {
if(dp[n][i]) {
int cur_s = i;
for(int j = n - 1; j >= 0; j--) {
if(cur_s - w[j] >= 0 && dp[j][cur_s - w[j]]) {
cur_s -= w[j];
result.push_back(j);
}
if(cur_s == 0) {
break;
}
}
break;
}
}
return result;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
336 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
336 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
1 ms |
336 KB |
Contestant can not find answer, jury can |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
336 KB |
Contestant can not find answer, jury can |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
336 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
336 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
1 ms |
336 KB |
Contestant can not find answer, jury can |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
336 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
336 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
1 ms |
336 KB |
Contestant can not find answer, jury can |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
336 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
336 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
1 ms |
336 KB |
Contestant can not find answer, jury can |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
OK (n = 1, answer = NO) |
2 |
Correct |
1 ms |
336 KB |
OK (n = 1, answer = NO) |
3 |
Correct |
0 ms |
336 KB |
OK (n = 1, answer = YES) |
4 |
Incorrect |
1 ms |
336 KB |
Contestant can not find answer, jury can |
5 |
Halted |
0 ms |
0 KB |
- |