Submission #1127111

#TimeUsernameProblemLanguageResultExecution timeMemory
1127111ZeroCoolA Difficult(y) Choice (BOI21_books)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
//#include "books.h"
using namespace std;
#define all(a) begin(a),end(a)

void solve(int n, int K, long long X, int S) {
    vector<int> A(n);
	vector<int> ans(K,0); 
    iota(all(ans), 1);
    int sum = 0;
	for(int i = 1; i <= K; i++){
		A[i] = skim(i);
        sum += A[i];
    }
	if(sum > 2*X) impossible();
	int l = K, r = n;
	while(l < r){
		int mid = (l + r + 1) / 2;
		if(sum - A[K] + skim(mid) <= 2 * X) l = mid;
		else r = mid - 1 ;
	}
	deque<int> dq(K, 0); 
    iota(all(dq), 1);
	for(int i = 0; i <= K; i++){
		sum -= A[K - i];
        sum+=skim(l - i);
		dq.pop_back(); 
        dq.push_front(l - i);
		if(sum >= X) answer(vector<int>(all(dq)));
	}
	impossible();
}

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:12:24: error: 'skim' was not declared in this scope
   12 |                 A[i] = skim(i);
      |                        ^~~~
books.cpp:15:23: error: 'impossible' was not declared in this scope
   15 |         if(sum > 2*X) impossible();
      |                       ^~~~~~~~~~
books.cpp:19:33: error: 'skim' was not declared in this scope
   19 |                 if(sum - A[K] + skim(mid) <= 2 * X) l = mid;
      |                                 ^~~~
books.cpp:26:14: error: 'skim' was not declared in this scope
   26 |         sum+=skim(l - i);
      |              ^~~~
books.cpp:29:30: error: 'answer' was not declared in this scope
   29 |                 if(sum >= X) answer(vector<int>(all(dq)));
      |                              ^~~~~~
books.cpp:31:9: error: 'impossible' was not declared in this scope
   31 |         impossible();
      |         ^~~~~~~~~~