Submission #272902

#TimeUsernameProblemLanguageResultExecution timeMemory
272902cheissmartGap (APIO16_gap)C++14
0 / 100
59 ms2028 KiB
#include "gap.h"
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define V vector
#define ALL(v) (v).begin(), (v).end()

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

long long findGap(int T, int N)
{
	if(T == 1) {
		int l = 1, r = N;
		ll lb = 0, rb = 1e18;
		V<ll> v(N + 1);
		while(l <= r) {
			ll mn, mx;
			MinMax(lb, rb, &mn, &mx);
			v[l] = mn, v[r] = mx;
			l++, r--;
			lb = mn+1, rb = mx-1;
		}
		ll ans = 0;
		for(int i = 0; i < N - 1; i++) ans = max(ans, v[i+1]-v[i]);
		return ans;
	} else {

	}
	return 0;
}

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