# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
810457 | Warinchai | Detecting Molecules (IOI16_molecules) | C++14 | 40 ms | 6176 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<pair<int,int> >v;
vector<int> find_subset(int l, int u,vector<int> w) {
for(int i=0;i<w.size();i++){
v.push_back({w[i],i});
}
sort(v.begin(),v.end());
deque<pair<int,int> >dq;
int i=0;
long long sum=0;
while(i<v.size()){
//cerr<<"push back"<<i<<endl;
dq.push_back(v[i]);
sum+=v[i].first;
//cerr<<"sum:"<<sum<<endl;
//cerr<<"sums:"<<endl;
while(sum>u){
//cerr<<sum<<endl;
sum-=dq.front().first;
dq.pop_front();
}
//cerr<<"remaining"<<endl;
//for(int i=0;i<dq.size();i++){
// cerr<<dq[i].second<<" ";
//}
//cerr<<endl;
if(sum>=l){
vector<int>ans;
for(int i=0;i<dq.size();i++){
ans.push_back(dq[i].second);
}
return ans;
}
i++;
}
return vector<int>(0);
}
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... |