Submission #656761

#TimeUsernameProblemLanguageResultExecution timeMemory
656761ktkeremA Difficult(y) Choice (BOI21_books)C++17
Compilation error
0 ms0 KiB
#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(ll n , ll m ,ll a , ll 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;
	ll p = 0;
	ll t = 0;
	for(ll i = 1;m > i;i++){
		if(kp[i] != -1){
			t+=kp[i];
			continue;
		}
		ll o = skim(i);
		kp[i] = o;
		t+=o;
	}
	ll ss = std::max(js - m , m+1);
	if(o + kp[js] >= a && 2 * a >= o + kp[sj]){
		std::vector<ll> vec;
		for(ll i = 1;m>i;i++){
			vec.pb(i);
		}
		vec.pb(js);
		answer(vec);
		return;
	}
	if(kp[m] == -1){
		kp[m] = skim(m);
	}
	t+= kp[m];
	if(t >= a && t<=2*a){
		std::vector<ll> 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){
			skim(o + ss -1);
		}
		t+=kp[o + ss - 1];
		t-=kp[o];
		if(t >= a && 2 * a >= t){
			std::vector<ll> 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 (stderr)

books.cpp: In function 'void solve(ll, ll, ll, ll)':
books.cpp:36:5: error: 'o' was not declared in this scope
   36 |  if(o + kp[js] >= a && 2 * a >= o + kp[sj]){
      |     ^
books.cpp:36:40: error: 'sj' was not declared in this scope; did you mean 'ss'?
   36 |  if(o + kp[js] >= a && 2 * a >= o + kp[sj]){
      |                                        ^~
      |                                        ss
books.cpp:42:10: error: could not convert 'vec' from 'vector<long long int>' to 'vector<int>'
   42 |   answer(vec);
      |          ^~~
      |          |
      |          vector<long long int>
books.cpp:54:10: error: could not convert 'vec' from 'vector<long long int>' to 'vector<int>'
   54 |   answer(vec);
      |          ^~~
      |          |
      |          vector<long long int>
books.cpp:72:11: error: could not convert 'vec' from 'vector<long long int>' to 'vector<int>'
   72 |    answer(vec);
      |           ^~~
      |           |
      |           vector<long long int>
books.cpp:24:5: warning: unused variable 'p' [-Wunused-variable]
   24 |  ll p = 0;
      |     ^