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 pii pair<int, int>
#define ff first
#define ss second
vector<int> find_subset(int L, int R, vector<int> w){
int n = w.size();
vector<pii> arr;
for(int i = 0; i < n; i++) arr.push_back({w[i], i});
sort(arr.begin(), arr.end());
vector<int> ans;
int l=0, r=1, sum=arr[0].ff;
while(r<n){
if(sum<L) sum += arr[r++].ff;
if(sum>R) sum -= arr[l++].ff;
if(sum>=L && sum<=R){
for(int i = l; i < r; i++) ans.push_back(arr[i].ss);
break;
}
}
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... |