Submission #1015206

# Submission time Handle Problem Language Result Execution time Memory
1015206 2024-07-06T07:32:07 Z vjudge1 Gap (APIO16_gap) C++17
Compilation error
0 ms 0 KB
// #include "gap.h"
#include <bits/stdc++.h>

using namespace std;

#define ll long long

long long findGap(signed t,signed n)
{
	if (t==2)
	{
		ll mn1,mx1;
		MinMax(0,(ll)1e18,&mn1,&mx1);
		ll st,mn,mx,ans=0;
		for (int i=0;i<=60;i++)
		{
			MinMax(mn1+1,mn1+(1LL<<i),&mn,&mx);
			if (mn!=-1)
			{
				ans=mn-mn1;
				st=mx;
				break;
			}
		}
		while (st<mx1)
		{
			MinMax(st+1,st+ans,&mn,&mx);
			if (mn!=-1)
				st=mx;
			else
			{
				int val=ans*2;
				while (1)
				{
					MinMax(st+1,st+val,&mn,&mx);
					if (mn!=-1)
					{
						ans=mn-st;
						st=mx;
						break;
					}
				}
				val*=2;
			}
		}
		return ans;
	}
	else
	{
		long long a[n],i=0,j=n-1,lim1=0,lim2=1e18;
		long long mn,mx;
		while (i<=j)
		{
			MinMax(lim1,lim2,&mn,&mx);
			a[i++]=mn;
			a[j--]=mx;
			lim1=mn+1;
			lim2=mx-1;
		}
		long long ans=0;
		for (int i=0;i<n-1;i++)
			ans=max(ans,a[i+1]-a[i]);
		
		return ans;
	}
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:13:3: error: 'MinMax' was not declared in this scope
   13 |   MinMax(0,(ll)1e18,&mn1,&mx1);
      |   ^~~~~~
gap.cpp:54:4: error: 'MinMax' was not declared in this scope
   54 |    MinMax(lim1,lim2,&mn,&mx);
      |    ^~~~~~