/*input
14 14
2
13 15
*/
/**
Author: Kristopher Paul
Date Created: 13-05-2019
Contest Name:
_/ _/ _/_/_/_/ _/ _/_/_/_/
_/ _/ _/ _/ _/ _/
_/_/ _/_/_/_/ _/ _/_/_/_/
_/ _/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/_/_/_/
**/
#include<bits/stdc++.h>
#define ll long long
//#define int ll
#define pb push_back
#define INF 0x3f3f3f3f //0x3f3f3f3f = 63
#define MOD 1000000007
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define umap unordered_map
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define itr :: iterator it
#define all(v) v.begin(),v.end()
#define WL(t) while(t--)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define out(x) cout << #x << " is " << x << endl
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
/*
int ModExp(int x,int y,int m){
int res = 1;
x = x % m;
while (y > 0)
{
if (y & 1)
res = (res*x) % m;
y = y>>1;
x = (x*x) % m;
}
return res;
}*/
vector<int> find_subset(ll l,ll u,vector<int> w){
vector<pair<ll,ll> > vec;
ll tot = 0;
vector<int> ans;
ans.clear();
vec.clear();
FOR(i,0,w.size()){
vec.pb({w[i],i});
tot += w[i];
}
if(tot < l){
return ans;
}
sort(vec.begin(),vec.end());
int i = 0,j = 0;
ll csum = 0;
if(vec[0].first > u){
return ans;
}
while(i <= w.size() && j <= w.size() && (csum > u || csum < l)){
if(csum > u){
csum -= vec[i++].first;
}else{
csum += vec[j++].first;
}
}
if(csum > u || csum < l){
return ans;
}
FOR(k,i,j){
ans.pb(vec[k].second);
}
return ans;
}
/*
void solve(){
vector<int> tst;
int l,u;
cin >> l >> u;
int n;
cin >> n;
FOR(i,0,n){
int x;
cin >> x;
tst.pb(x);
}
vector<int> ans = find_subset(l,u,tst);
FOR(i,0,ans.size()){
cout << ans[i] << " ";
}
cout << endl;
}
signed main(){
FastIO;
int t = 1;
// cin >> t;
WL(t){
solve();
}
}
*/
Compilation message
molecules.cpp: In function 'std::vector<int> find_subset(long long int, long long int, std::vector<int>)':
molecules.cpp:25:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
#define FOR(i,a,b) for (int i = a; i < b; i++)
molecules.cpp:66:9:
FOR(i,0,w.size()){
~~~~~~~~~~~~
molecules.cpp:66:5: note: in expansion of macro 'FOR'
FOR(i,0,w.size()){
^~~
molecules.cpp:79:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(i <= w.size() && j <= w.size() && (csum > u || csum < l)){
~~^~~~~~~~~~~
molecules.cpp:79:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(i <= w.size() && j <= w.size() && (csum > u || csum < l)){
~~^~~~~~~~~~~
/tmp/ccPmEx8B.o: In function `main':
grader.cpp:(.text.startup+0x152): undefined reference to `find_subset(int, int, std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status