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;
const int N = 200 * 1000 + 5;
pair <int, int> a[N];
long long ps[N];
std::vector<int> find_subset(int l, int r, std::vector<int> w) {
vector <int> ans;
int n = w.size();
for (int i = 1; i <= n; i++) {
a[i] = {w[i - 1], i - 1};
ps[i] = ps[i - 1] + a[i].first;
}
sort(a + 1, a + n + 1);
// for (int i = 1; i <= n; i++) {
// cout << "71 " << a[i].first << " " << a[i].second << endl;
// }
for (int i = 0; i < n; i++) {
int x = lower_bound(ps, ps + n + 1, ps[i] + l) - ps;
if (x <= n && ps[x] - ps[i] <= r) {
for (int j = i + 1; j <= x; j++) {
ans.push_back(a[j].second);
}
return ans;
}
}
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... |