#include "molecules.h"
#include <bits/stdc++.h>
#define fi first
#define se second
#define all(v) v.begin(), v.end()
#define dbg(v) cerr << "\n" << #v << " = " << v << "\n"
using namespace std;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector<pair<int,int>> a;
for (int i = 0; i < n; ++i) a.push_back({w[i], i});
sort(all(a));
int le = 0, sum = 0;
vector<int> res;
for (int i = 0; i < n; ++i) {
sum += a[i].fi;
while (i-le+1 > 1 && sum > u) sum -= a[le++].fi;
if (l <= sum && sum <= u) {
for (int j = le; j <= i; ++j) res.push_back(a[j].se);
break;
}
}
return res;
}
int main() {
int n, l, u;
assert(3 == scanf("%d %d %d", &n, &l, &u));
std::vector<int> w(n);
for (int i = 0; i < n; i++)
assert(1 == scanf("%d", &w[i]));
std::vector<int> result = find_subset(l, u, w);
printf("%d\n", (int)result.size());
for (int i = 0; i < (int)result.size(); i++)
printf("%d%c", result[i], " \n"[i == (int)result.size() - 1]);
}
Compilation message
/usr/bin/ld: /tmp/cconJIMK.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc15W9xK.o:molecules.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status