# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
812693 | elotelo966 | 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.
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll
std::vector<int> find_subset(int l, int u, std::vector<int> w){
vector <pair<ll,ll>> dizi;
ll n=w.size();
for(ll i=0;i<n;i++){
dizi.push_back({w[i],i});
}
sort(dizi.begin(),dizi.end());
ll le=0,r=0,sum=0;
bool stop=false;
while(le<=r && r<n){
if(sum+dizi[r].first<l){
sum+=dizi[r].first;
r++;
}
else if(sum+dizi[r].first>=l && sum+dizi[r].first<=u){
stop=true;
break;
}
else{
sum-=dizi[le].first;
le++;
}
}
vector <ll> cev;
if(stop){
for(int i=le;i<=r;i++){
cev.push_back(ger[i].second);
}
sort(cev.begin(),cev.end());
}
return cev;
}