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 v, int u, vector<int> w) {
int n = w.size();
long long sum = 0;
vector<pair<int, int>> arr;
for (int i = 0; i < n; i++)
{
arr.push_back({w[i], i});
}
sort(arr.begin(), arr.end());
int l = 0, r = 0;
while(true){
if(sum > u){
if(l == r) return {};
sum -= arr[l++].first;
}
else if(sum < v){
if(r == n){
return {};
}
sum += arr[r++].first;
}
else{
break;
}
}
vector<int> ans;
for(int i = l; i < r; ++i){
ans.push_back(arr[i].second);
}
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... |