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<bits/stdc++.h>
#include "molecules.h"
using namespace std;
typedef long long int ll;
#define debug(x) cerr << #x << " = " << (x) << endl
vector<int> find_subset(int l, int u, vector<int> w) {
int n = w.size();
vector<pair<int, int>> arr(n);
for (int i = 0; i < n; i++) {
arr[i] = { w[i], i };
}
sort(arr.begin(), arr.end());
vector<int> presum(n);
vector<int> ans;
for (int k = 1; k <= n; k++) {
for (int i = 0; i + k <= n; i++) {
ll sum = 0;
for (int j = i; j < i + k; j++) {
sum += arr[j].first;
}
if (sum >= l && sum <= u) {
debug(sum);
for (int j = i; j < i + k; j++) {
ans.push_back(arr[j].second);
}
break;
}
}
if (!ans.empty()) break;
}
return ans;
// return 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... |