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;
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector<pair<int, int>> v(n);
for(int i = 0; i < n; i++){
v[i] = {w[i], i};
}
sort(v.begin(), v.end());
ll sum = 0;
int frst = 0;
for(int i = 0; i < n; i++){
sum += v[i].first;
if(sum >= l && sum <= u){
vector<int> ans;
for(int j = frst; j <= i; j++) ans.push_back(v[j].second);
return ans;
}
if(sum > u){
sum -= v[frst].first;
frst++;
if(sum >= l && sum <= u){
vector<int> ans;
for(int j = frst; j <= i; j++) ans.push_back(v[j].second);
return ans;
}
}
}
return {};
}
# | 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... |