Submission #667337

#TimeUsernameProblemLanguageResultExecution timeMemory
667337radalGap (APIO16_gap)C++17
30 / 100
44 ms1872 KiB
#include "gap.h"
#include <bits/stdc++.h>
#pragma GCC target("sse,sse2,avx2")
#pragma GCC optimize("unroll-loops,O2")
#define rep(i,l,r) for (int i = l; i < r; i++)
#define repr(i,r,l) for (int i = r; i >= l; i--)
#define X first
#define Y second
#define all(x) (x).begin() , (x).end()
#define pb push_back
#define endl '\n'
#define debug(x) cerr << #x << " : " << x << endl;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pll;
constexpr int N = 1e5+15,mod = 1e9+7;
constexpr ll inf = 1e18+10;

ll a[N];

long long findGap(int T, int n)
{
	if (T == 2) return 0;
	int m = (n+1)/2;
	ll x = -inf,y = inf;
	rep(i,0,m){
		MinMax(x,y,a+i,a+n-i-1);
		x = a[i]+1;
		y = a[n-i-1]-1;
	}
	ll ans = 0;
	rep(i,1,n) ans = max(ans,a[i]-a[i-1]);
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...