# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
68893 | mr_banana | Detecting Molecules (IOI16_molecules) | C++17 | 131 ms | 29980 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>
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
vector<pair<int,int> > v;
for(int i=0;i<w.size();i++){
v.push_back({w[i],i});
}
set<pair<int,int> > ans;
sort(v.begin(),v.end());
long long sum=0;
for(int i=0;i<v.size();i++){
if(sum+v[i].first<=u){
sum+=v[i].first;
ans.insert(v[i]);
}
else if(sum+v[i].first-ans.begin()->first<=u){
sum+=v[i].first-ans.begin()->first;
ans.erase(ans.begin());
ans.insert(v[i]);
}
}
vector<int> ans1;
if(sum>=l){
for(auto i:ans){
ans1.push_back(i.second);
}
}
return ans1;
}
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... |