# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
868303 | LOLOLO | Detecting Molecules (IOI16_molecules) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector <int> find_subset(ll l, ll r, vector <ll> arr) {
vector <pair <ll, ll>> v;
for (int i = 0; i < sz(arr); i++)
v.pb({arr[i], i});
sort(all(v));
vector <int> lst;
ll s = 0, st = 0;
for (int j = 0; j < sz(v); j++) {
s += v[j].f;
while (s > r) {
s -= v[st].f;
st++;
}
if (s >= l) {
for (int f = st; f <= j; f++) {
lst.pb(v[f].s);
}
return lst;
}
}
return {0};
}