# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
131625 | neki | Detecting Molecules (IOI16_molecules) | C++14 | 2 ms | 376 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 "molecules.h"
#include <bits/stdc++.h>
#define loop(i, a, b) for(int i=a;i<b;i++)
#define cc(a) cout<< a << endl;
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
map<int, int> dp;
vector<int> ans;
loop(i, 1, w.size()+1){
for(auto&& j: dp) if(j.first+w[i-1]<=u and dp[j.first+w[i-1]]==0) dp[j.first+w[i-1]]=i;
if(dp[w[i-1]]==0)dp[w[i-1]]=i;
auto it=dp.lower_bound(l);
if(it!=dp.end() and it->second!=0 and l<=it->first and it->first<=u){
int cnt=it->first;
while(cnt!=0){
ans.push_back(dp[cnt]-1);
cnt-=w[dp[cnt]-1];
}
break;
}
}
return ans;
}
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... |