Submission #423567

#TimeUsernameProblemLanguageResultExecution timeMemory
423567victoriadGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include "vector" #include <cmath> using namespace std; long long findGap(int T, int N) { vector<long long>a(N); long long i=0; long long int hi=1e18,low=0; if(T==1){ while(i<=(N-1)/2){ long long int s=low,t=hi; MinMax(low,hi,&s,&t); if(s==t){ if(s<0)continue; a[i]=t; break; } else{ a[i]=s; low=s+1; a[N-1-i]=t; hi=t-1; } i++; } long long int x=0; for(int k=0;k<N-1;k++){ if(x<(a[k+1]-a[k]))x=a[k+1]-a[k]; } return x; } else{ long long int s,t; MinMax(low,hi,&s,&t); a[0]=s; a[N-1]=t; long long int x=1; low=s+1; while(x<=N/2){ MinMax(low,hi,&s,&t); a[x]=s; x++; low=s+1; } low=0; hi=t-1; while(x<N-1){ MinMax(low,hi,s,t); a[x]=t; hi=t-1; x++; } x=0; for(int k=0;k<N-1;k++){ if(x<(a[k+1]-a[k]))x=a[k+1]-a[k]; } return x; } }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:49:17: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   49 |   MinMax(low,hi,s,t);
      |                 ^
      |                 |
      |                 long long int
In file included from gap.cpp:1:
gap.h:1:35: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                   ^~~~~~~~~~
gap.cpp:49:19: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   49 |   MinMax(low,hi,s,t);
      |                   ^
      |                   |
      |                   long long int
In file included from gap.cpp:1:
gap.h:1:47: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
    1 | void MinMax(long long, long long, long long*, long long*);
      |                                               ^~~~~~~~~~