제출 #209575

#제출 시각아이디문제언어결과실행 시간메모리
209575LawlietGap (APIO16_gap)C++14
30 / 100
77 ms1912 KiB
#include "gap.h"
#include <bits/stdc++.h>

using namespace std;
typedef long long int lli;

const int MAXN = 100010;

lli v[MAXN];

long long findGap(int T, int N)
{
	lli L = 0LL;
	lli R = 1000000000000000000LL;

	for(int i = 1 ; i <= N - i + 1 ; i++)
	{
		lli aux1, aux2;
		lli *mx = &aux1; 
		lli *mn = &aux2;

		MinMax( L , R , mn , mx );

		v[i] = aux2;
		v[N - i + 1] = aux1;

		L = aux2 + 1;
		R = aux1 - 1;
	}

	lli ans = 0;

	for(int i = 1 ; i < N ; i++)
		ans = max( ans , v[i + 1] - v[i] );

	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...