#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
// #include "molecules.h"
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <map>
#include <iomanip>
#include <cmath>
#include <queue>
#include <bitset>
#include <numeric>
#include <array>
#include <cstring>
#include <random>
#include <chrono>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector<pair<int, int> > a(n);
for(int i = 0; i < n; i++) {
a[i].fi = w[i];
a[i].se = i;
}
sort(all(a));
vector<int> ans;
int cur = a[0].fi, lb = 0, rb = 1;
while(lb < n) {
while(rb < n && cur < l) cur += a[rb++].fi;
if(cur >= l && cur <= u) break;
cur -= a[lb++].fi;
}
for(; lb < rb; lb++) ans.pb(a[lb].se);
return ans;
}
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int l, u, n;
cin >> l >> u >> n;
vector<int> a(n);
for(int i = 0; i < n; i++) cin >> a[i];
auto ans = find_subset(l, u, a);
for(auto& x : ans) cout << x << ' ';
return 0;
}
/*
*/
Compilation message
molecules.cpp:3:0: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
#pragma GCC optimization ("unroll-loops")
/tmp/ccw17VYB.o: In function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'
/tmp/ccuXsq6Z.o:molecules.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status