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) {
vector<long long> x(n + 1);
for (int i = 1; i <= n; ++i) x[i] = skim(i);
assert(x[1] > 0);
auto d = x;
for (int i = 1; i <= n; ++i) d[i] += d[i - 1];
vector<int> ret;
for (int i = k; i <= n; ++i) {
if (a <= d[i] - d[i - k] && d[i] - d[i - k] <= a * 2) {
for (int j = i - k + 1; j <= i; ++j) ret.push_back(j);
answer(ret);
return;
}
}
for (int i = k; i <= n; ++i) {
if (a <= d[k - 1] + x[i] && d[k - 1] + x[i] <= 2 * a) {
for (int j = 1; j < k; ++j) ret.push_back(j);
ret.push_back(i);
answer(ret);
return;
}
}
impossible();
}
# | 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... |