This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "molecules.h"
#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdio>
#include <iterator>
#include <functional>
#include <unordered_set>
#include <unordered_map>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define vi vector<int>
#define fast_io ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef long long ll;
typedef short inth;
const int N = 1e4;
const int M = N + 7;
const int MOD = 1e9 + 7;
const ll INF = 1e16 + 17;
bool dp[M];
int par[M];
vector<int> find_subset(int l, int u, vector<int> w) {
dp[0] = true;
for (int i = 0; i < sz(w); ++i) {
for (int j = N; j >= w[i]; --j) {
if (!dp[j] && dp[j - w[i]]) {
dp[j] = true;
par[j] = i;
}
}
}
vector<int> ans;
int v = 0;
for (int i = l; i <= u; ++i) {
if (dp[i]) {
v = i;
break;
}
}
while (v) {
ans.pb(par[v]);
v -= w[par[v]];
}
sort(all(ans));
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |