# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
889548 | shiomusubi496 | A Difficult(y) Choice (BOI21_books) | C++17 | 167 ms | 600 KiB |
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;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
using ll = long long;
void solve(int N, int K, long long A, int S) {
assert(N == S);
vector<ll> B(N);
rep (i, N) B[i] = skim(i + 1);
ll cur = 0;
vector<int> ans{N};
rep (i, K) {
rep (j, ans.back() - K + i + 1) {
ll sm = 0;
rep (k, K - i) sm += B[j + k];
if (cur + sm < A) continue;
if (cur + sm <= 2 * A) {
rep (k, K - i) ans.push_back(j + k);
ans.erase(ans.begin());
for (int& x : ans) ++x;
answer(ans);
return;
}
ans.push_back(j + K - i - 1);
cur += B[j + K - i - 1];
break;
}
if (ans.size() == i + 1) {
impossible();
return;
}
}
impossible();
}
Compilation message (stderr)
# | 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... |