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 <bits/stdc++.h>
#include "molecules.h"
using namespace std;
#define rall(s) s.rbegin(), s.rend()
#define all(s) s.begin(), s.end()
#define sz(s) (int)s.size()
#define s second
#define f first
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
vector<int> find_subset(int l, int r, vector<int> w) {
int dp[r + 1], n = sz(w);
memset(dp, 0, sizeof(dp));
dp[0] = -1;
for (int i = 1; i <= n; i++) {
int x = w[i - 1];
for (int j = r; j >= x; j--) {
if (dp[j - x] && !dp[j]) dp[j] = i;
}
}
for (int i = l; i <= r; i++) {
if (dp[i]) {
vector<int> res;
while (i) {
res.push_back(dp[i]);
i -= w[dp[i] - 1];
}
return res;
}
}
return {};
}
# | 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... |