Submission #1292134

#TimeUsernameProblemLanguageResultExecution timeMemory
1292134goulthenGap (APIO16_gap)C++20
8.45 / 100
109 ms3828 KiB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;

#define ll long long
#define pb push_back
#define rep(i,a,b) for(int i = a; i <= b; i++)
const int MAXN = 1e5+10;
ll a[MAXN];

vector<ll> dc(ll l, ll r) {
	ll mid = (l+r)/2;

	vector<ll> res;
	ll s = l, t = r;
	MinMax(s,t,&s,&t);
	if(s==-1) {
		// meh
	}
	else if(s==t) {
		res.pb(s);
	}
	else {
		for(ll x : dc(l,mid)) res.pb(x);
		for(ll x : dc(mid+1,r)) res.pb(x);
	}
	return res;
	//hihiha
}

ll findGap(int T, int N)
{
	vector<ll> a;
	a = dc(0LL,(ll)1e18);

	ll ans = 0;
	rep(i,0,N-2) ans = max(ans, a[i+1]-a[i]);
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...