# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
774597 | JMs | Detecting Molecules (IOI16_molecules) | C++17 | 39 ms | 4936 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)
{
unsigned const long long tam = 200005;
long long aux, ph, pl, s;
vector <int> result;
vector<pair<int, int> > v;
for( long long i=0; i<w.size(); i++){
v.push_back(make_pair(w[i], i));
}
sort(v.begin(), v.end());
pl=0;
ph=0;
s=v[0].first;
while(1){
//cout<<pl<<" "<<ph<<" "<<s<<endl;
if(s<l && ph<w.size()-1){
ph++;
s+=v[ph].first;
}
else if(s>u && pl<ph){
s-=v[pl].first;
pl++;
}
else if( s>u || s<l ){
return vector<int>();
break;
}
else{
for( long long i=pl; i<=ph; i++){
//cout<<v[i].second<<" ";
result.push_back(v[i].second);
}
//cout<<endl;
break;
}
}
return result;
}
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... |