# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
919640 | Nurislam | 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 <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
vector<int> find_subset(int l, int r, vector<int> temp) {
vector<int> ans;
int n=temp.size();
vector<pair<int, int>> w;
for (int i = 0; i < n; ++i)
{
w.push_back({temp[i], i});
}
sort(w.begin(), w.end());
int i = 0, j = 0, sum = 0;
while(j < n){
sum+=w[j++].first;
while(sum > r){
sum -= w[i++].first;
}
if(sum > l){
for(; i <= j; i++){
ans.pb(w[i].second);
}return ans;
}
}
return ans;
}