#include<bits/stdc++.h>
#include "books.h"
typedef long long ll;
typedef std::pair<ll , ll> llll;
typedef std::string str;
#define debug std::cout << "debug" << std::endl
#define pb push_back
void solve(int n , int m ,ll a , int s){
ll l = 1 , r = n;
ll kp[n + 1];
memset(kp , -1 , sizeof(kp));
while(r > l){
ll md = (l+r)/2;
ll z = skim(md);
kp[md] = z;
if(z>a){
r = md;
}
else{
l=md+1;
}
}
ll js = l;
if(kp[js] == -1){
kp[js] = skim(js);
}
if(m > js){
impossible();
}
ll p = 0;
ll t = 0;
for(ll i = 1;m > i;i++){
if(kp[i] == -1){
ll o = skim(i);
kp[i] = o;
}
t+=kp[i];
}
ll ss = std::max(js - m , (ll)m+1);
if(t + kp[js] >= a && 2 * a >= t + kp[js]){
std::vector<int> vec;
for(ll i = 1;m>i;i++){
vec.pb(i);
}
vec.pb(js);
answer(vec);
return;
}
if(m >= js){
impossible();
}
if(kp[m] == -1){
kp[m] = skim(m);
}
t+= kp[m];
t-=kp[js];
if(t >= a && t<=2*a){
std::vector<int> vec;
for(ll i = 1;m>=i;i++){
vec.pb(i);
}
answer(vec);
return;
}
ll o = 1;
while(o + ss <= js){
if(kp[o + ss - 1] == -1){
kp[o + ss - 1] = skim(o + ss -1);
}
t+=kp[o + ss - 1];
t-=kp[o];
if(t >= a && 2 * a >= t){
std::vector<int> vec;
for(ll i = o+1;m>=i;i++){
vec.pb(i);
}
for(ll i = 0;o>i;i++){
vec.pb(ss + i);
}
answer(vec);
return;
}
o++;
}
impossible();
}
/*int main(){
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
freopen("out.txt","w",stdout);
#endif
ll t = 1;std::cin >> t;
while(t--){
solve();
}
return 0;
}*/
Compilation message
servers.cpp:2:10: fatal error: books.h: No such file or directory
2 | #include "books.h"
| ^~~~~~~~~
compilation terminated.