# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
557494 | Mounir | A Difficult(y) Choice (BOI21_books) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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();
}