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 f first
#define sc second
using namespace std;
typedef long long int ll;
typedef vector <int> v_i;
vector<int> find_subset(int l, int u, vector<int> w){
int n = w.size();
vector <pair<int, int>> v;
for(int i = 0; i < n; i++) v.pb({w[i], i});
sort(v.begin(), v.end());
bool b = false;
ll s = 0;
int inl = 0, inr = -1;
for(int i = 0; i < n; i++){
s+=v[i].f, inr++;
if(s > u) while(s > u) s-= v[inl].f, inl++;
if(s >= l && s <= u){
b = true;
break;
}
}
vector<int> ans;
if(!b) return ans;
else{
for(int i = 0; i <= inr-inl+1; i++) ans.pb(v[inl+i].sc);
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... |