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 ;
#define endl '\n'
vector <int> ans ;
vector <pair <int , int>> vec ;
std::vector<int> find_subset(int l, int u, vector<int> w) {
int sum = 0 , x = 0 ;
int n = w.size() ;
for ( int i = 0 ; i < n ; i ++ ) vec.push_back({w[i],i}) ;
sort ( vec.begin() , vec.end() ) ;
for ( int i = 0 ; i < n ; i ++ ){
sum += vec[i].first ;
while ( sum > u ) sum -= vec[x].first , x ++ ;
if ( sum >= l && sum <= u ){
for ( int j = x ; j <= i ; j ++ ) ans.push_back(vec[j].second) ;
break ;
}
}
sort ( ans.begin() , ans.end() ) ;
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... |