# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
557494 | Mounir | A Difficult(y) Choice (BOI21_books) | C++14 | 0 ms | 0 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 nLivres, int aPrendre, long long borneInf, int S) {
vector<long long> vals(nLivres);
long long sum = 0;
for (int i = 0; i < aPrendre; ++i)
vals[i] = skim(i + 1), sum += vals[i];
if (sum > 2 * borneInf)
impossible();
vector<int> ans = {};
if (sum >= borneInf){
for (int i = 1; i <= aPrendre; ++i)
ans.pb(i);
answer(ans);
return;
}
for (int i = aPrendre; i < nLivres; ++i){
vals[i] = skim(i + 1);
sum += vals[i] - vals[i - aPrendre];
if (sum >= borneInf){
if (sum > 2 * borneInf){
for (int j = 1; j < aPrendre; ++j)
ans.pb(j);
ans.pb(i);
answer(ans);
}
else {
for (int j = 0; j < aPrendre; ++j)
ans.pb(i - j);
answer(ans);
}
}
}
impossible();
}