Submission #549782

#TimeUsernameProblemLanguageResultExecution timeMemory
549782ToroTNGap (APIO16_gap)C++14
0 / 100
47 ms1084 KiB
#include<bits/stdc++.h>
using namespace std;
#include "gap.h"
long long t,n,st,ed,mn,mx,ans=-1;
long long findGap(int T, int N)
{
	t=T;
	n=N;
	if(t==1)
	{
		st=0;
		ed=1e18;
		for(int i=1;i<=(n+1)/2;i++)
		{
			MinMax(st,ed,&mn,&mx);
			//printf("%d %lld %lld %lld %lld\n",i,st,mn,mx,ed);
			if(i>1)
			{
				ans=max(ans,mn-st-1);
				ans=max(ans,ed-mx+1);
			}
			st=mn+1;
			ed=mx-1;
		}
		ans=max(ans,ed-st+2);
		return ans;
	}
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:28:1: warning: control reaches end of non-void function [-Wreturn-type]
   28 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...