Submission #81220

# Submission time Handle Problem Language Result Execution time Memory
81220 2018-10-24T07:01:11 Z AngelKnows Gap (APIO16_gap) C++14
Compilation error
0 ms 0 KB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;

#define ll long long
ll mn,mx;
ll l,r,mid;
ll a[100005];
int h,t;
ll ans;
unsigned long long now,pre;
unsigned long long len;
long long findGap(int T, int N)
{
	if (T==1) {
		h=0,t=N+1;
		l=0,r=1e18+1;
		for (;;) {
			MinMax(l,r,&mn,&mx);
			a[++h]=mn,a[--t]=mx;
			l=mn+1,r=mx-1;
			if (h>=t-1) break;
		}
		for (int i=1;i<=N-1;i++) {
			ll t=a[i+1]-a[i];
			if (t>ans) ans=t;
		}
	} else {
		MinMax(0,1e18+1,mn,mx);
		now=mn;
		len=1;
		pre=mn;
		ll top=mx;
		ll d=1;
		while (now+1<=top) {
			ll t=top;
			if (now+len<t) t=now+len; 
			MinMax(now+d,t,&mn,&mx);
			if (mn==-1) {
				now+=len;
				d=1;
				len*=2;
			} else {
				ans=max(ans,mn-(ll)pre);
				d=now+len-mx+1;
				now=mx;
				pre=mx;
				len=1; 
			}
		}
	}
	return ans;
}

Compilation message

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:29:24: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   MinMax(0,1e18+1,mn,mx);
                        ^
In file included from gap.cpp:1: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:29:24: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   MinMax(0,1e18+1,mn,mx);
                        ^
In file included from gap.cpp:1: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:35:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while (now+1<=top) {
          ~~~~~^~~~~
gap.cpp:37:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    if (now+len<t) t=now+len; 
        ~~~~~~~^~