#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
// #include "molecules.h"
#include <cstdio>
using namespace std;
#define ll long long
const int M = 4e6 + 10;
int n;
bool dp[M];
vector<int> bit[M];
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
n = w.size();
vector<int> possible{0};
vector<int> answ;
dp[0] = true;
for(int i = 0; i < n; i++) {
vector<int> to_add;
for(auto j: possible) {
if(j + w[i] > u || dp[j + w[i]]) {
continue;
}
dp[j + w[i]] = true;
to_add.push_back(j);
}
for(auto j: to_add) {
bit[j + w[i]] = bit[j];
bit[j + w[i]].push_back(i);
if(j + w[i] >= l && j + w[i] <= u) {
return bit[j + w[i]];
}
possible.push_back(j + w[i]);
}
}
return answ;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
35 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
38 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
35 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
35 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
35 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
35 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |