Submission #68192

# Submission time Handle Problem Language Result Execution time Memory
68192 2018-08-16T07:58:29 Z gusfring Gap (APIO16_gap) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "gap.h"

using namespace std;

typedef long long ll;
const int MAXN = 1e5 + 5;
const ll MAXA = 1000000000000000000LLU;

ll mn, mx;
	
ll solve(ll lo, ll hi){
	if(lo >= hi) return 0;
	unsigned long long x = (1LLU * lo + hi) / 2;
	ll mid = (ll)(x), mn1 = -1, mx1 = -1, mn2 = -1, mx2 = -1;
	MinMax(lo, mid, mn1, mx1);
	if(mid < hi) MinMax(mid + 1, hi, mn2, mx2);
	ll res = 0, r1 = 0, r2 = 0;
	if(mx1 != -1 && mx2 != -1) res = mn2 - mx1;
	if(mx2 != -1) r2 = solve(mid + 1, hi);
	if(mx1 != -1) r1 = solve(lo, mid);
	return max({res, r1, r2});
}

long long findGap(int T, int N){
	return solve(0, MAXA);
}

Compilation message

gap.cpp: In function 'll solve(ll, ll)':
gap.cpp:16:26: error: invalid conversion from 'll {aka long long int}' to 'long long int*' [-fpermissive]
  MinMax(lo, mid, mn1, mx1);
                          ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^~~~~~
gap.cpp:16:26: error: invalid conversion from 'll {aka long long int}' to 'long long int*' [-fpermissive]
  MinMax(lo, mid, mn1, mx1);
                          ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^~~~~~
gap.cpp:17:43: error: invalid conversion from 'll {aka long long int}' to 'long long int*' [-fpermissive]
  if(mid < hi) MinMax(mid + 1, hi, mn2, mx2);
                                           ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^~~~~~
gap.cpp:17:43: error: invalid conversion from 'll {aka long long int}' to 'long long int*' [-fpermissive]
  if(mid < hi) MinMax(mid + 1, hi, mn2, mx2);
                                           ^
In file included from gap.cpp:2:0:
gap.h:1:6: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^~~~~~