Submission #43534

# Submission time Handle Problem Language Result Execution time Memory
43534 2018-03-17T12:07:55 Z faustaadp Gap (APIO16_gap) C++14
Compilation error
0 ms 0 KB
#include "gap.h"
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll i,has;
vector<ll> v;
void tanya(ll aa,ll bb)
{
	if(aa==bb)
		v.pb(aa);
	if(aa>bb)
		return ;
	ll mi,ma;
	MinMax(aa,bb,&mi,&ma);
	if(mi!=ma)
	{
		ll ce=(aa+bb)/2;
		tanya(mi,max(ce,mi));
		tanya(min(ce+1,ma),max);
	}
	else
		v.pb(mi);
}
long long findGap(int T, int N)
{
	ll L,R;
	MinMax(0,1e18,&L,&R);
	tanya(L,R);
	for(i=1;i<v.size();i++)
		has=max(has,v[i]-v[i-1]);
	return has;
}

Compilation message

gap.cpp: In function 'void tanya(long long int, long long int)':
gap.cpp:23:25: error: cannot resolve overloaded function 'max' based on conversion to type 'long long int'
   tanya(min(ce+1,ma),max);
                         ^
gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:33:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=1;i<v.size();i++)
           ^