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"
//#include "grader.cpp"
using namespace std;
const int N = (int)1e5+1;
int dp[N], path[N];
vector<int> find_subset(int l, int r, vector<int> a) {
// cout << "DSKDJ:ASKLDJ:AS";
vector <int> ans;
for(int i = 0; i < N; i ++) path[i] = -1, dp[i] = 0;
dp[0] = 1;
path[0] = -1;
for(auto coin : a) {
// cout << coin << " ";
for(int j = N-1; j >= 0; j --) {
if(j-coin >= 0) {
if(dp[j-coin]) {
dp[j] |= dp[j-coin];
path[j] = coin;
}
}
}
}
for(int i = l; i <= r; i ++) {
if(dp[i]) {
for(int u = i;;) {
if(path[u] == -1) break;
ans.push_back(path[u]);
u -= path[u];
}
return 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... |