Submission #1162456

#TimeUsernameProblemLanguageResultExecution timeMemory
1162456minh30082008Gap (APIO16_gap)C++20
30 / 100
28 ms1996 KiB
#include <stdio.h>
#include <stdlib.h>
#include "gap.h"


#include<bits/stdc++.h>
#define INF 1e18
#define fi first
#define se second
#define FOR(i, k, n) for(ll i = k; i <= n; i++)
#define FOR1(i, k, n) for(ll i = k; i >= n; i--)
#define pb push_back
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define ll long long
#define vll vector<ll>
#define pll pair<ll, ll>
#define re return 0
#define mii map<int, int>
#define input "chinaflu.inp"
#define output "chinaflu.out"
#define rf 	freopen(input, "r", stdin); freopen(output, "w", stdout)
using namespace std;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 9;
const int base = 998244353;
void add(int &a, int b) 
{
	a += b; 
	if(a >= mod) a -= mod; 
	if(a < 0) a += mod; 
}
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
int rand(int l, int r)
{
	return uniform_int_distribution<int>(l, r) (rd);
}

ll a[maxn];
ll findGap(int sub, int n)
{
	if(sub == 1)
	{
		ll minn = -1, maxx = -1;
		ll l = 0, r = 1e18;
		int d = 1, c = n;
		while(d <= c)
		{
			minn = -1;
			maxx = -1;
			MinMax(l, r, &minn, &maxx);
			a[d] = minn;
			a[c] = maxx;
			l = minn + 1;
			r = maxx - 1;
			d++;
			c--;
		}
		ll ans = 0;
		FOR(i, 1, n - 1)
			ans = max(ans, a[i + 1] - a[i]);
		return ans;
	}
	return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...