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 "books.h"
using namespace std;
void solve(int n, int k, long long A, int S) {
function<long long(int)> get = [&](int i) {
long long sum = 0;
for (int j = i; j < i + k; j++)
sum += skim(j);
return sum;
};
int l = 1, r = n - k + 1;
while (r - l > 1) {
int m = (l + r) / 2;
if (get(m) >= A)
r = m;
else
l = m;
}
int ind = -1;
long long s1 = get(l), s2 = get(r);
if (s1 >= A && s1 <= 2 * A) {
ind = l;
} else if (s2 >= A && s2 <= 2 * A) {
ind = r;
}
if (ind == -1) {
impossible();
return;
}
vector<int> ans;
for (int j = ind; j < ind + k; j++)
ans.emplace_back(j);
answer(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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |