Submission #254835

#TimeUsernameProblemLanguageResultExecution timeMemory
254835maximath_1Gap (APIO16_gap)C++11
30 / 100
68 ms1928 KiB
#include "gap.h"
#include <iostream>
using namespace std;

#define ll long long
const ll mn = 0ll, mx = 1e18;

ll arr[100005];

ll findGap(int t, int n){
	ll lf = mn, rg = mx, k = 0;
	for(int i = n; i > 0; i -= 2){
		MinMax(lf, rg, &arr[k], &arr[n - 1 - k]);
		lf = arr[k] + 1;
		rg = arr[n - 1 - k] - 1;
		k ++;
	}

	ll res = mn;
	for(int i = 1; i < n; i ++)
		res = max(res, arr[i] - arr[i - 1]);

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