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 "grader.cpp"
#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
vector<int> find_subset(int l, int u, vector<int> w) {
vector<int> ans;
int mn = *min_element(all(w)), k = count(all(w), mn);
for(int i = 0; i <= k; i ++){
int t = i * mn;
if(u < t)break;
if(l <= t and t <= u){
for(int j = 0; j < (int)w.size(); j ++){
if(w[j] == mn and i > 0){
ans.push_back(j);
i --;
}
if(i == 0)break;
}
break;
}
int left = (l - t + mn) / (mn + 1);
if(left > (int)w.size() - k or t + left * (mn + 1) > u)continue;
for(int j = 0; j < (int)w.size(); j ++){
if(w[j] == mn and i > 0){
ans.push_back(j);
i --;
}
if(w[j] == mn + 1 and left > 0){
ans.push_back(j);
left --;
}
}
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... |