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 F first
#define S second
std::vector<int> find_subset(int l, int u, vector<int> z){
vector<int> v;
vector<pair<int, int>> w;
int c=0, s=0, n=z.size();
for(int i=0; i<n; i++){
w.push_back({z[i], i});
}
sort(w.begin(), w.end());
reverse(w.begin(), w.end());
for(int i=0; i<n; i++){
while(s<l&&c<n){
s+=w[c].F;
c++;
}
if(l<=s&&s<=u){
for(int t=i; t<c; t++)v.push_back(w[t].S);
break;
}
s-=w[i].F;
}
while(s<l&&c<n){
s+=w[c].F;
c++;
}
if(l<=s&&s<=u){
for(int t=n-1; t<c; t++)v.push_back(w[t].S);
}
return v;
}
# | 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... |