Submission #901572

#TimeUsernameProblemLanguageResultExecution timeMemory
901572ByeWorldGap (APIO16_gap)C++14
30 / 100
34 ms2144 KiB
#include "gap.h"
#include <bits/stdc++.h>
#define bupol __builtin_popcount
//#define int long long 
#define ll long long
#define ld long double
#define fi first
#define se second
#define pb push_back
#define lf (id<<1)
#define rg ((id<<1)|1)
#define md ((l+r)>>1)
using namespace std;
const int MAXN = 1e5+5;
const int MAXK = 205;
const int LOG = 20;
const int MOD = 1e9+7;
const int SQRT = 520;
const ll INF = 1e18+10;
typedef pair<ll,ll> pii;
typedef pair<ll,pii> ipii;

ll mn, mx;
ll x, y;
int n;
ll a[MAXN], ans;

long long findGap(int T, int N)
{
	n = N;
	x = 0; y = INF;
	for(int i=1; i<=(n+1)/2; i++){
		MinMax(x, y, &mn, &mx);
		a[i] = mn; a[n-i+1] = mx;
		//cout << mn << ' '<< mx << " p\n";
		x = mn+1; y = mx-1;
	}
	for(int i=1; i<=n-1; i++){
		ans = max(ans, a[i+1]-a[i]);
	}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...