# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
942867 | beepbeepsheep | A Difficult(y) Choice (BOI21_books) | C++17 | 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;
//
// --- Sample implementation for the task books ---
//
// To compile this program with the sample grader, place:
// books.h books_sample.cpp sample_grader.cpp
// in a single folder and run:
// g++ books_sample.cpp sample_grader.cpp
// in this folder.
//
#define ll long long
void solve(int N, int K, long long A, int S) {
// TODO implement this function
s=1,e=N;
for (int i=s;i<=e;i++){
arr[i]=skim(i);
}
if (e-s+1<K){
impossible();
return;
}
vector<int> v;
for (int i=s;i<=e-K+1;i++){
ll tot=0;
for (int j=i;j<=i+K-1;j++){
v.emplace_back(j);
tot+=arr[j];
}
//cerr<<endl<<i<<' '<<i+K-1<<' '<<tot<<endl;
if (tot>=A && tot<=2*A){
answer(v);
return;
}
v.clear();
}
impossible();
}