Submission #1032310

#TimeUsernameProblemLanguageResultExecution timeMemory
1032310Marco_EscandonA Difficult(y) Choice (BOI21_books)C++17
Compilation error
0 ms0 KiB

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const string ny[2] = {"No", "Yes"};
//#include"books.h"
void solve(int n, int k, long long a, int S) {
	ll cad[n+1]={ };
	ll v[k+2]={ },ac=0;
	v[k]=n+3;
	for(int i=1; i<=n; i++)
	{
		cad[i]=skim(i);
		if(i<=k)
		{
			v[i-1]=i;
			ac+=cad[i];
		}
	}
	for(int i=k-1; i>-1; i--)
	{
		ll temp=ac-cad[v[i]]+cad[v[i]+1];
		while(temp<2*a&&ac<a&&v[i]<v[i+1]-1&&v[i]<n)
		{
			ac-=cad[v[i]];
			v[i]++;
			ac+=cad[v[i]];
			temp=ac-cad[v[i]]+cad[v[i]+1];
		}
	}
	if(ac<a)
		impossible();
	vector<int> ans;
	for(int i=0; i<k; i++)
		ans.push_back(v[i]);
	answer(ans);
}

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:13:10: error: 'skim' was not declared in this scope
   13 |   cad[i]=skim(i);
      |          ^~~~
books.cpp:32:3: error: 'impossible' was not declared in this scope
   32 |   impossible();
      |   ^~~~~~~~~~
books.cpp:36:2: error: 'answer' was not declared in this scope
   36 |  answer(ans);
      |  ^~~~~~