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 r, vector<int> w) {
vector<int> ans;
int n = w.size();
vector<pair<int,int>> v;
for(int i = 0;i<n;i++){
v.push_back({w[i],i});
}
sort(v.begin(),v.end());
long long sum = 0;
long long sufsum = 0;
for(auto u:w)sufsum += u;
int pt2 = 0;
for(int i = 0;i<=n;i++){
if(i)
sum += v[i-1].first;
while(pt2 != n && (pt2 < i || sufsum + sum > r)){
sufsum -= v[pt2].first;
pt2++;
}
if(sum + sufsum >= l){
for(int c = 0;c<i;c++){
ans.push_back(v[c].second);
}
for(int c = n-1;c>=pt2;c--){
ans.push_back(v[c].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... |