Submission #107590

#TimeUsernameProblemLanguageResultExecution timeMemory
107590MinnakhmetovGap (APIO16_gap)C++14
30 / 100
59 ms3592 KiB
#include "gap.h"
#include <algorithm>
using namespace std;

#define ll long long
const ll MAX = 1e18;
const int N = 1e5 + 5;
ll a[N];


long long findGap(int t, int n)
{
	if (t == 1) {
		ll l = 0, r = MAX;
		int x = 0, y = n - 1;
		while (x <= y) {
			MinMax(l, r, &a[x], &a[y]);
			l = a[x] + 1;
			r = a[y] - 1;
			x++;
			y--;
		}
		ll mx = 0;
		for (int i = 0; i < n - 1; i++)
			mx = max(mx, a[i + 1] - a[i]);
		return mx;
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...