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 ff first
#define sc second
using namespace std;
vector<int> find_subset(int l, int r, vector<int> w){
vector<pair<int, int>> vec; vector<int> zero; zero.push_back(0);
int sz = w.size(), sum = w[0];
for(int i = 0; i < sz; i++) vec.push_back({w[i], i});
sort(vec.begin(), vec.end());
int L = 0, R = 1;
while(R < sz){
if(sum <= r) sum += vec[R++].ff;
if(sum > r) sum -= vec[L++].ff;
if(l <= sum && sum <= r){
vector<int> ans;
for(int i = L; i < R; i++) ans.push_back(vec[i].sc);
return ans;
}
}
return zero;
}
# | 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... |