# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1192953 | yoshi | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 0 KiB |
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ss second
#define ff first
using namespace std;
ll df[1234567],ans;
vector<ll> vv[1234567];
vector<ll> find_subset(ll l ,ll u, vector<ll> w){
ll n=w.size();
vector<pair<ll,ll>> a;
for(ll i=0; i<n; i++){
a.pb({w[i], i});
}
sort(a.begin(), a.end());
ll sum=0,k=0;
for(ll r=0; r<n; r++){
sum+=a[r].ff;
if(sum>u){
sum-=a[k].ff;
k++;
}
if(sum>l){
vector<ll> ans;
for(ll i=k; i<=r; i++){
ans.pb(a[i].ss);
}
return ans;
}
}
return {};
}