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 <bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#include "molecules.h"
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector <pair <ll,ll> > a(w.size());
int n=w.size();
for (int i=0;i<n;i++) a[i].first=w[i], a[i].second=i;
sort(a.begin(),a.end());
long long sum=0, q=0;
for (int i=0;i<n;i++){
while (q < n && sum < l) sum+=a[q].first, q++;
if (sum >= l && sum <= u and u-l >= a[n-1].first-a[0].first){
vector <int> ans;
for (int j=i;j<q;j++) ans.push_back(a[j].second);
sort(ans.begin(), ans.end());
return ans;
}
sum-=a[i].first;
}
return vector <int> ();
}
# | 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... |