Submission #117910

#TimeUsernameProblemLanguageResultExecution timeMemory
117910Mahdi_JfriGap (APIO16_gap)C++14
30 / 100
48 ms1912 KiB
#include "gap.h"
#include<bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back

const int maxn = 1e5 + 20;

ll a[maxn];

long long findGap(int T, int n)
{
		ll l = 0 , r = 1e18;
		for(int i = 0; i < (n + 1) / 2; i++)
		{
			ll x , y;
			MinMax(l , r , &x , &y);
			a[i] = x;
			a[n - i - 1] = y;
			l = x + 1 , r = y - 1;
		}

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

		return res;
	return 0;
}





#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...