# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
677549 | hello_there_123 | Detecting Molecules (IOI16_molecules) | C++17 | 1086 ms | 4440 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;
vector<int> find_subset(int l,int u,vector<int> w){
vector<pair<int,int> >lol;
for(int i=0;i<w.size();i++){
lol.push_back(make_pair(w[i],i));
}
sort(lol.begin(),lol.end());
int n = w.size();
vector<int>ans;
vector<int>cur;
queue<pair<int,int> >q;
for(int i=1;i<=n;i++){
while(!q.empty()) q.pop();
cur.clear();
int sum = 0;
for(int j=i-1;j>=0;j--){
sum+=lol[n-j-1].first;
q.push(make_pair(lol[n-j-1].first,lol[n-j-1].second));
}
if(sum<l) continue;
for(int j=0;j<i;j++){
if(sum<=u && sum>=l){
while(!q.empty()){
ans.push_back(q.front().second);
q.pop();
}
return ans;
}
else{
sum-=q.front().first;
q.pop();
sum+=lol[j].first;
q.push(make_pair(lol[j].first,lol[j].second));
}
}
if(sum<=u && sum>=l){
while(!q.empty()){
ans.push_back(q.front().second);
q.pop();
}
return ans;
}
}
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... |