#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
#define pb push_back
#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));
ll 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 {};
}
Compilation message (stderr)
molecules.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
1 | #pragma once
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |