# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
683160 | Juan | Detecting Molecules (IOI16_molecules) | C++14 | 1096 ms | 340 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;
#define pii pair<int, int>
#define ff first
#define ss second
vector<int> ans;
vector<pii> arr;
int ll, uu;
bool dp(int id, int sum){
if(sum>uu) return false;
if(sum>=ll && sum<=uu) return true;
for(int i = id; i < arr.size(); i++){
if(dp(i+1, sum+arr[i].ff)){
ans.push_back(arr[i].ss);
return true;
}
}
return false;
}
vector<int> find_subset(int l, int u, vector<int> w){
ll = l, uu = u;
for(int i = 0; i < w.size(); i++) arr.push_back({w[i], i});
sort(arr.begin(), arr.end(), greater<pii>());
dp(0, 0);
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... |