# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
819254 | LeVanThuc | 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<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define p(x,y) pair<ll,ll>(x,y)
#define BIT(i,x) ((x>>i)&1)
#define MASK(x) (1<<x)
#define ld long double
#define __builtin_popcount __builtin_popcountll
#define pll pair<ll,ll>
template<class T1,class T2>
bool maximize(T1 &x,const T2 &y)
{
if(x<y)
{
x=y;
return 1;
}
return 0;
}
template<class T1,class T2>
bool minimize(T1 &x,const T2 &y)
{
if(x>y)
{
x=y;
return 1;
}
return 0;
}
void online()
{
std::ios_base::sync_with_stdio(0);
cin.tie(0);
//#ifndef ONLINE_JUDGE
// freopen("input.inp", "r", stdin);
// freopen("output.out","w", stdout);
//#else
//#endif
}
const ll M=1e9,N=1e5+10;
vector<int> find_subset(int l,int r,vector<int> w)
{
vector<pll> vt;
for(int i=0;i<w.size();i++)
{
vt.emplace_back(w[i],i);
}
sort(vt.begin(),vt.end());
ll sum=0;
ll j=0;
vector<int> res;
for(int i=0;i<w.size();i++)
{
sum+=vt[i].fi;
while(sum>r&&j<i)
{
sum-=vt[j].fi;
j++;
}
if(sum>=l&&sum<=r)
{
for(int k=j;k<=i;k++) res.push_back(vt[i].se);
return res;
}
}
return res;
}
int main()
{
}