# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
995683 | kokoue | Detecting Molecules (IOI16_molecules) | C++14 | 0 ms | 348 KiB |
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>
using namespace std;
set<long long> is;
unordered_map<long long,long long> idx;
vector<int> find_subset(int l,int u,vector<int> w)
{
int n=w.size();
is.insert(0);
idx[0]=0;
int sum=0;
bool fl=0;
for(int i=0;i<n;i++)
{
for(auto it=is.rbegin();it!=is.rend();it++)
{
long long e=*it;
is.insert(e+w[i]);
idx[e+w[i]]=i;
if(e+w[i]>=l && e+w[i]<=u)
{
sum=e+w[i];
fl=1;
break;
}
}
if(fl) break;
}
int h=0;
vector<int> res;
while(sum!=0)
{
res.push_back(idx[sum]);
sum-=w[idx[sum]];
}
return res;
}
Compilation message (stderr)
# | 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... |