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;
vector<int> find_subset(int l, int u, vector<int> w) {
int siz=w.size();
pair<int,int> arr[siz];
for(int i=0;i<siz;i++){
arr[i]={w[i],i};
}
sort(arr,arr+siz);
long long int sum1=0,sum2=0;
vector<int> ans;
for(int i=0;i<siz;i++){
sum1+=arr[i].first;
sum2+=arr[siz-i-1].first;
if(!(sum1<=u&&l<=sum2)){
continue;
}
int j=i;
while(sum1<l){
sum1-=arr[j-i].first;
j++;
sum1+=arr[j].first;
}
for(int k=j-i;k<=j;k++){
ans.push_back(arr[k].second);
}
return ans;
}
return ans;
}
# | 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... |