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 fi first
#define se second
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
pair<int,int> A[n];
for(int i=0;i<n;i++) A[i] = {w[i],i};
sort(A,A+n);
int lo = 0,hi = 0,sum = 0;
while(hi < n) {
sum += A[hi++].fi;
while(lo < hi and sum > u) sum -= A[lo++].fi;
if(sum >= l and sum <= u) {
vector<int> ret(hi - lo);
for(int i=lo;i<hi;i++) ret[i-lo] = A[i].se;
return ret;
}
}
return vector<int>(0);
}
# | 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... |