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 l, int r, vector<int> w) {
vector<int> ans;
int n = w.size();
vector<pair<int,int>> v;
for(int i = 0;i<n;i++){
v.push_back({w[i],i});
}
long long sum = 0;
for(int i = 0;i<=n;i++){
if(i)
sum += v[i-1].first;
long long tmp = sum;
for(int j = n;j>=i;j--){
if(j != n)
tmp += v[j].first;
if(l <= tmp && tmp <= r && ans.empty()){
for(int c = 0;c<i;c++){
ans.push_back(v[c].second);
}
for(int c = n-1;c>=j;c--){
ans.push_back(v[c].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... |