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;
vector<int> find_subset(int L, int R, vector<int> w){
int pref = 0, suff = 0, n = w.size();
int r;
vector<int> ans;
bool found = false;
for(int i = 0; i < n; i++){
pref+=w[i], suff+=w[n-1-i];
if(pref<=R && suff>=L){
found = true, r = i+1;
break;
}
}
if(!found) return ans;
int l=0, sum=pref;
while(true){
if(sum>=L && sum<=R){
for(int i = l; i < r; i++) ans.push_back(i);
break;
}
sum += w[r++] - w[l++];
}
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... |