# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
866923 | maks007 | Detecting Molecules (IOI16_molecules) | C++14 | 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 "grader.cpp"
#include "bits/stdc++.h"
using namespace std;
vector<int> find_subset(int L, int R, vector <int> a) {
vector <int> ans;
int sum = a[0], l = 0, r = 0, n = a.size();
while(1) {
if(sum < L) {
r ++;
if(r == n) return ans;
sum += a[r];
}else if(sum > R) {
if(l == n) return ans;
sum -= a[l];
l ++;
}else break;
}
if(sum >= L && sum <= R) {
for(int i = l; i <= r; i ++) ans.push_back(i);
return ans;
}
return ans;
}