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 ;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size() ;
map<int , vector<int> > pos ;
for(int i = 0 ; i < n ; i ++){
pos[w[i]].push_back(i);
}
int firstn , secondn ;
firstn = pos.begin()->first , secondn = pos.end()->first ;
int cnt1 , cnt2 ;
if(firstn == secondn)
cnt2 = secondn = 0 ;
cnt1 = pos[firstn].size() ;
cnt2 = pos[secondn].size();
for(int i = 0 ; i <= cnt1 ; i ++ ){
long long sum = i * firstn ;
for(int j = 0 ; j <= cnt2 ; j ++){
sum += (j * secondn);
if(sum >= l && sum <= u){
vector<int>ans ;
for(int c = 0 ; c < j ; c ++){
ans.push_back(pos[firstn][c]);
}
for(int c = 0 ; c < j ; c ++){
ans.push_back(pos[secondn][c]);
}
return ans ;
}
}
}
return vector<int>() ;
}
# | 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... |