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 tl, int tr, vector<int> w )
{
int n = w.size();
vector< pair<int,int> > a(n);
for ( int i=0; i<n; i++ )
a[i] = { w[i], i+1 };
sort( a.begin(), a.end() );
int sum = 0;
int l = 0, r = -1;
while ( r+1 < n )
{
r++;
sum += a[r].first;
while ( l <= r && sum > tr )
{
sum -= a[l].first;
l++;
}
if ( l <= r && tl <= sum )
{
vector<int> ans;
for ( int i=l; i<=r; i++ )
ans.push_back( a[i].second );
return ans;
}
}
return {};
}
# | 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... |