# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
919637 | 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());
long long sum=0;
int i = 0, r = 0, sum = 0;
while(r < n){
sum+=w[r++].first;
while(sum > r){
sum -= w[i++].first;
}
if(sum > l){
for(; i <= r; i++){
ans.pb(w[i].second);
}return ans;
}
}
return ans;
}