Submission #42674

# Submission time Handle Problem Language Result Execution time Memory
42674 2018-03-02T03:44:15 Z MatheusLealV Gap (APIO16_gap) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "gap.h"
#define N 100005
#define inf 1000000000000000000LL
using namespace std;
typedef long long ll;
 
ll n, v[N], ans[N];
 
vector<ll> val;
 
void solve(ll ini, ll fimi, ll best)
{
 	 retun;
	if(ini > fimi) return;
 
	ll a, b, fim = ini + best;
 
  	MinMax(ini, fim, &a, &b);
 
  	if(a != -1 && b != -1) val.push_back(a), val.push_back(b);
 
  	solve(ini + best + 1, fimi, best);
}
 
ll findGap(int T, int N_)
{
	ll best = 0;
 
	if(T == 1)
	{
		n = N_;
 
		ll esq = 0, dir = inf;
 
		for(int i = 1, st = 1, en = n; i <= (n + 1)/2; i++, st ++, en --)
		{
			ll a, b;
 
			MinMax(esq, dir, &a, &b);
 
			esq = a + 1, dir = b - 1;
 
			if(a != -1 && b != -1) ans[st] = a, ans[en] = b;
		}
 
		for(int i = 2; i <= n; i++) best = max(best, ans[i] - ans[i - 1]);
 
		return best;
	}
 
	else
	{
		ll st, en, dx;
 
		MinMax(0, inf, &st, &en);
 
		if((en - st)%(n - 1)) dx = 1 + (en - st)/(n - 1);
 
		else dx = (en - st)/(n - 1);
 
		solve(st, en, dx);
 
		sort(val.begin(), val.end());
 
		for(int i = 1; i < val.size(); i++) dx = max(dx, val[i] - val[i - 1]);
 
		return dx;
	}
 
}

Compilation message

gap.cpp: In function 'void solve(ll, ll, ll)':
gap.cpp:14:4: error: 'retun' was not declared in this scope
    retun;
    ^
gap.cpp: In function 'll findGap(int, int)':
gap.cpp:66:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 1; i < val.size(); i++) dx = max(dx, val[i] - val[i - 1]);
                    ^