# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1188408 | lioow | Detecting Molecules (IOI16_molecules) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define repp(i,x,n) for(int i=x;i<=n;i++)
#define rep(i,x,n) for(int i=x;i>=n;i--)
#define cy cout<<"YES"<<endl
#define cn cout<<"NO"<<endl
#define r0 return 0
#define fi first
#define se second
#define liow ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define jelek cout<<"jelek"<<endl
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define pi pair<pair<int,int>,pair<int,int>>
#define p3 pair<int,pair<int,int>>
#define p2
#define tp tuple<int,int,int>
#define fl fflush(stdout)
#define lb long double
#define p5 pair<int,pair<pair<int,int>,pair<int,int>>>
vector<int> find_subset(int d,int u,vector<int>w){
vector<int>ans;
int l=0,r=0,n=w.size()-1;
vector<pii>a;
repp(i,0,n){
a.pb({w[i],i});
}
sort(all(a));
int sum=0;
for(;l<n && r<n;r++){
sum+=a[r].fi;
while(sum>u){
sum-=a[l].fi;
l++;
}
if(d<=sum && sum<=u){
repp(i,l,r){
ans.pb(a[i].se);
}
return ans;
}
}
return {};
}
//signed main(){
// liow;
// int t=1;
//// cin>>t;
// while(t--){
// solve();
// }
//}