Submission #111365

#TimeUsernameProblemLanguageResultExecution timeMemory
111365diamond_dukeGap (APIO16_gap)C++11
0 / 100
59 ms3960 KiB
#include <algorithm>
#include "gap.h"
using ll = long long;
namespace solver_1
{
	ll arr[100005];
	ll solve(int n)
	{
		int l = 0, r = n - 1;
		while (l <= r)
		{
			ll pre = l ? arr[l - 1] : -1, nxt = r + 1 < n ? arr[r + 1] : 1e18 + 1;
			MinMax(pre + 1, nxt - 1, &arr[l++], &arr[r--]);
		}
		ll res = 0;
		for (int i = 1; i < n; i++)
			res = std::max(res, arr[i] - arr[i - 1]);
		return res;
	}
}
ll findGap(int T, int N)
{
	if (T == 1)
		return solver_1::solve(N);
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...