제출 #42627

#제출 시각아이디문제언어결과실행 시간메모리
42627MatheusLealVGap (APIO16_gap)C++14
30 / 100
80 ms2232 KiB
#include <bits/stdc++.h>
#include "gap.h"
#define N 100005
using namespace std;
typedef long long ll;
 
ll n, v[N], ans[N];
 
ll findGap(int T, int N_)
{
	n = N_;
 
	ll esq = 0, dir = 2000000000000000000LL, best = 0;
 
	for(int i = 1, st = 1, en = n; i <= (n + 1)/2; i++, st ++, en --)
	{
		ll a, b;
 
		MinMax(esq, dir, &a, &b);
 
		esq = a + 1, dir = b - 1;
 
		if(a != -1 && b != -1) ans[st] = a, ans[en] = b;
	}
 
	for(int i = 2; i <= n; i++) best = max(best, ans[i] - ans[i - 1]);
 
	return best;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...