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>
//#include "grader.cpp"
using namespace std;
vector<pair<int,int>> vec;
vector<int> get(int l, int r){
vector<int> ans;
for(int i=l;i<=r;i++) ans.push_back(vec[i].second);
sort(ans.begin(),ans.end());
return ans;
}
vector<int> find_subset(int v, int u, vector<int> w) {
int n=w.size();
int sum=0;
for(int i=0;i<n;i++)
vec.push_back({w[i],i});
sort(vec.begin(),vec.end());
int l=0;
for(int r=0;r<n;r++){
sum+=vec[r].first;
if(sum<v) continue;
if(v<=sum && sum<=u){
return get(l,r);
}
else{
while(l<=r && sum>u){
sum-=vec[l].first;
l++;
}
if(v<=sum && sum<=u){
return get(l,r);
}
}
}
return {};
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |