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;
set <int> vec ;
map <int , vector <int> > mp ;
vector<int> find_subset( int l , int r , vector<int> a ){
vec.insert(0) ;
vector <int> ans ;
int n = a.size() , f = 0 ;
for ( int i = 0 ; i < n ; i ++ ){
vector <int> cur ;
for ( auto j : vec ){
if ( j + a[i] <= r && vec.find(j+a[i]) == vec.end() ) cur.push_back(j) ;
}
for ( auto j : cur ){
vec.insert(j+a[i]) ;
mp[j+a[i]] = mp[j] ;
mp[j+a[i]].push_back(i+1) ;
if ( l <= j+a[i] && j+a[i] <= r ){
ans = mp[j+a[i]] ;
f = 1 ;
break ;
}
}
if (f) break ;
}
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... |