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 long long ll;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
vector<int> res;
vector<pair<ll,int>> w_sort;
int n=w.size();
for(int i=0;i<n;i++){
w_sort.push_back({w[i],i});
}
sort(w_sort.begin(),w_sort.end(),greater<pair<ll,int>>());
ll sum=0;
for(auto p:w_sort){
if(sum+p.first<u){
sum+=p.first;
res.push_back(p.second);
}
}
return (sum>=l)?res:(std::vector<int>(0));
}
# | 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... |