# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
872439 | Zero | Detecting Molecules (IOI16_molecules) | C++17 | 0 ms | 0 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.
vector<int> find_subset(int l, int u, vector<int> a){
int mn = 0,n = a.size();
vector<int> v;
int s = 0;
bool jj = true;
for(int i=0,j=0; i < n && j < n;){
if(s>=l && s <= u){
if(jj)j--;
else i++;
if(i == j) v.pb(i);
else v.pb(i);v.pb(j);
break;
}
if(s < l) s += a[j],j++,jj=true;
if(s>u) s-=a[i], i ++,jj=false;
}
return v;
}