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 "molecules.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long int lli;
vector< int > ans;
vector< pii > sweep;
vector<int> find_subset(int lower, int upper, vector<int> w)
{
int N = w.size();
for(int i = 0 ; i < N ; i++)
sweep.push_back( { w[i] , i } );
sort( sweep.begin() , sweep.end() );
int R = 0;
lli sum = 0;
for(int L = 0 ; L < N ; L++)
{
if( L > R )
{
R = L;
sum = 0;
}
while( R < N && sum < lower )
sum += sweep[ R++ ].first;
if( lower <= sum && sum <= upper )
{
for(int j = L ; j < R ; j++)
ans.push_back( sweep[j].second );
return ans;
}
sum -= sweep[L].first;
}
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... |