Submission #536160

#TimeUsernameProblemLanguageResultExecution timeMemory
536160mario05092929Gap (APIO16_gap)C++17
Compilation error
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; ll a[100005]; int lp,rp; long long findGap(int T, int n) { ll l = 0, r = 1e18,mn,mx; if(T & 1) { MinMax(l,r,&mn,&mx); lp = 1, rp = n; while(1) { a[lp++] = mn; a[rp--] = mx; l = mn+1, r = mx-1; if(lp > rp) break; MinMax(l,r,&mn,&mx); } ll mxx = 0; for(int i = 1;i < n;i++) { mxx = max(mxx,a[i+1]-a[i]); } return mxx; } else { MinMax(l,r,mn,mx); ll diff = 0; ll len = (mx-mn)/n+1; ll st = mn+1; ll tmn,tmx; for(int i = 1;i <= n;i++) { MinMax(st,st+len,tmn,tmx); if(tmn == -1) continue; diff = max(diff,tmn-mn); mn = tmx; } return diff; } }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:27:20: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   27 |         MinMax(l,r,mn,mx);
      |                    ^~
      |                    |
      |                    ll {aka 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:27:23: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   27 |         MinMax(l,r,mn,mx);
      |                       ^~
      |                       |
      |                       ll {aka 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*);
      |                                               ^~~~~~~~~~
gap.cpp:33:30: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   33 |             MinMax(st,st+len,tmn,tmx);
      |                              ^~~
      |                              |
      |                              ll {aka 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:33:34: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   33 |             MinMax(st,st+len,tmn,tmx);
      |                                  ^~~
      |                                  |
      |                                  ll {aka 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*);
      |                                               ^~~~~~~~~~