Submission #203931

#TimeUsernameProblemLanguageResultExecution timeMemory
203931SegtreeGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include<iostream> #include<algorithm> #include<vector> #include"gap.h" using namespace std; typedef long long ll; #define chmin(a,b) a=min(a,b) #define chmax(a,b) a=max(a,b) #define rep(i,n) for(int i=0;i<n;i++) #define mod 1000000007 #define mad(a,b) a=(a+b)%mod /* ll a[100010],n,m; void MinMax(ll s,ll t,ll &mn,ll &mx){ m++; ll l,r,mid; l=-1,r=n; while(l<r-1){ mid=(l+r)>>1; if(a[mid]>=s)r=mid; else l=mid; } mn=a[r]; l=-1,r=n; while(l<r-1){ mid=(l+r)>>1; if(a[mid]<=t)l=mid; else r=mid; } mx=a[l]; }*/ ll findGap(ll T,ll N){ ll A[100010]; A[0]=-1,A[N+1]=1e18+1; ll l=0,r=N+1; while(l+1<=r-1){ ll mn,mx; MinMax(A[l]+1,A[r]-1,mn,mx); l++,r--; A[l]=mn,A[r]=mx; } ll ans=0; for(int i=1;i<=N-1;i++)ans=max(ans,A[i+1]-A[i]); return ans; } /* int main(){ n=100000; rep(i,n)a[i]=rand()%mod; sort(a,a+n); ll ans=0; rep(i,n-1)chmax(ans,a[i+1]-a[i]); m=0; cout<<ans<<endl; cout<<findGap(0,n)<<endl; cout<<"m="<<m<<endl; }*/

Compilation message (stderr)

gap.cpp: In function 'll findGap(ll, ll)':
gap.cpp:39:29: error: invalid conversion from 'll {aka long long int}' to 'long long int*' [-fpermissive]
   MinMax(A[l]+1,A[r]-1,mn,mx);
                             ^
In file included from gap.cpp:4: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:39:29: error: invalid conversion from 'll {aka long long int}' to 'long long int*' [-fpermissive]
   MinMax(A[l]+1,A[r]-1,mn,mx);
                             ^
In file included from gap.cpp:4: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*);
      ^~~~~~