이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "books.h"
using namespace std;
#define ll long long
#define int ll
#define ld long double
#define pii pair<int, int>
#define f first
#define s second
#define boost() cin.tie(0), cin.sync_with_stdio(0)
int h[100005], in[100005];
void solve(int32_t n, int32_t k, int a, int32_t s) {
memset(h, 0, sizeof(h));
memset(in, 0, sizeof(in));
vector<int32_t> ret;
int sum = 0;
for (int i = 1; i < k; i++) {
h[i] = skim(i);
sum += h[i];
in[i] = 1;
}
int lo = k, hi = n, mid;
while (lo < hi) {
mid = (lo + hi + 1) / 2;
h[mid] = skim(mid);
if (sum + h[mid] > 2 * a) hi = mid - 1;
else lo = mid;
}
h[lo] = skim(lo);
in[lo] = 1;
sum += h[lo];
if (sum > 2 * a) impossible();
if (sum >= a) {
for (int i = 0; i < 100005; i++) if (in[i]) ret.push_back(i);
answer(ret);
}
for (int i = 1; i < k; i++) {
h[lo - i] = skim(lo - i);
sum += h[lo - i] - h[k - i];
in[k - i] = 0, in[lo - i] = 1;
if (sum >= a) {
for (int j = 0; j < 100005; j++) if (in[j]) ret.push_back(j);
answer(ret);
}
}
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... |