# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
772996 | Imeon | A Difficult(y) Choice (BOI21_books) | C++17 | 186 ms | 1076 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;
void solve(int N, int K, long long A, int S) {
// cin >> N >> K >> S >> A;
long long x[N + 1];
long long sm = 0;
int f = 0;
K--;
for (int i = 1; i <= N;i++){
x[i] = skim(i);
if (i <= K)sm += x[i];
}
int l = K,r = N + 1;
while (l + 1 < r){
int md = (l + r) / 2;
if ((x[md] + sm) > 2ll * A)r = md;
else l = md;
}
sm += x[l];
if (l == K or sm > 2LL * A)impossible();
if (sm >= A and sm <= 2LL * A){
vector<int>v;
for (int j = 1; j <= K; j++){
v.push_back(j);
}
v.push_back(l);
answer(v);
}
K++;
sm = 0;
for (int i = 1; i <= N;i++){
sm += x[i];
if (i > K){sm -= x[i - K];}
if (i >= K and sm >= A and sm <= 2LL * A){
vector<int>v;
for (int j = i - K + 1; j <= i; j++){
v.push_back(j);
}
answer(v);
}
}
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... |