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> 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 beg=0;
for (int i=0; i<n; i++) {
sum+=w[i].first;
while (sum>r) sum-=w[beg++].first;
if (sum>=l) {
for (int j=beg; j<=i; j++) ans.push_back(w[j].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... |