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 <bits/stdc++.h>
using namespace std;
unordered_map<int, vector<int>> dp{};
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
for (int i = 0; i < (int)w.size(); i++) {
int prev = -1;
for (int j = l-1; j > 0 && prev - 1000 < j; j--) {
if (dp[j].size() > 0 && j+w[i] <= u) {
prev = j;
dp[j+w[i]] = dp[j];
dp[j+w[i]].push_back(i);
if (j+w[i] >= l) return dp[j+w[i]];
}
}
dp[w[i]] = {i};
if (w[i] >= l && w[i] <= u) return dp[w[i]];
}
return std::vector<int>(0);
}
# | 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... |