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>
using namespace std;
#define ll long long
#define pii pair<ll,ll>
#define ff first
#define ss second
#define pb push_back
vector<int> find_subset(int l, int u, std::vector<int> w){
int N = w.size();
vector<pii> obj(N);
for(int i = 0; i < N; i++) obj[i] = {w[i], i};
sort(obj.begin(), obj.end());
vector<int> v(N+1, 0);
for(int i = 1; i <= N; i++) v[i] = v[i-1] + obj[i-1].ff;
vector<int> ans;
for(int i = 1; i <= N; i++){
int p = upper_bound(v.begin(), v.end(), v[i-1]+u+1) - v.begin() - 1;
if(p < 0 || v[p] - v[i-1] < l || v[p] - v[i-1] > u) continue;
for(; i <= p; i++) ans.pb(obj[i].ss);
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... |