# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
774595 | JMs | Detecting Molecules (IOI16_molecules) | C++17 | 1 ms | 1748 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 v[tam], aux, ph, pl, s;
vector <int> result;
for( long long i=0; i<w.size(); i++){
v[i]=i;
}
for( long long i=0; i<w.size()-1; i++){
for( long long j=i+1; j<w.size(); j++){
if(w[i]>w[j]){
aux=w[j];
w[j]=w[i];
w[i]=aux;
aux=v[j];
v[j]=v[i];
v[i]=aux;
}
}
}
pl=0;
ph=0;
s=w[0];
while(1){
//cout<<pl<<" "<<ph<<" "<<s<<endl;
if(s<l && ph<w.size()-1){
ph++;
s+=w[ph];
}
else if(s>u && pl<ph){
s-=w[pl];
pl++;
}
else if( s>u || s<l ){
return vector<int>();
break;
}
else{
for( long long i=pl; i<=ph; i++){
cout<<v[i]<<" gf";
result.push_back(v[i]);
}
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... |