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 pb push_back
#define ll long long
#define f first
#define s second
using namespace std;
vector <int> find_subset (int l, int u, vector <int> w){
int n = w.size();
vector<int> r;
vector<pair<ll,ll>> vec;
for(int i=0;i<n;i++)vec.pb({w[i],i});
sort(vec.begin(),vec.end());
ll sum = 0;
for(int i=0,j=0;j<n;j++){
sum += vec[j].f;
while(sum>u){
sum -= vec[i++].f;
}
if(sum>=l){
for(int k=i;k<=j;k++){
r.pb(vec[k].s);
}
break;
}
}
return r;
}
# | 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... |