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;
typedef long long ll;
bool possible[10001];
ll current[10001];
vector<int> find_subset(int l, int u, vector<int> w) {
ll n = w.size();
possible[0] = 1;
current[0] = -1;
for(ll i=0;i<n;i++)
{
for(ll j=10000-w[i];j>=0;j--)
{
if(!possible[j]) continue;
if(possible[j+w[i]]) continue;
possible[j+w[i]]=1;
current[j+w[i]]=i;
}
}
//cout<<"hello\n";
for(ll i=l;i<=u;i++)
{
if(possible[i])
{
vector<int> res;
ll j = i;
while(j!=0)
{
res.push_back(current[j]);
j = j - w[current[j]];
//cout<<j<<" "<<current[j]<<"\n";
}
return res;
break;
}
}
return 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... |