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;
typedef long long ll;
pair <ll, ll> niz[200005];
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int n = w.size();
ll L = l, R = u;
for(int i=1; i<=n; i++){
niz[i].first = w[i-1];
niz[i].second = i-1;
}
int lg=1, r=1;
sort(niz+1, niz+1+n);
ll sum=niz[1].first;
vector <int> arr;
while(r <= n){
if(sum <= R && sum >= L){
//cout << r-l+1 << "\n";
for(int i=lg; i<=r; i++) arr.push_back(niz[i].second);
return arr;
}
else if(sum > R) {sum -= niz[lg].first; lg++;}
else if(sum < L) {r++; sum += niz[r].first;}
}
return arr;
}
# | 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... |