Submission #274631

#TimeUsernameProblemLanguageResultExecution timeMemory
274631test2Gap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "gap.h" //#pragma GCC optimize("Ofast") //#pragma GCC target("avx,avx2,fma") //#pragma GCC optimization ("unroll-loops") #define I inline void using ll = long long ; using ld = long double ; using namespace std ; const int mod = 1e9 + 7 ; // how interesting! int n; struct node{ ll pref = 0 , suff = 0 , summ = 0 , mxx = 0 ; I maint(){ mxx = max(max(mxx , pref) , max(suff , summ)) ; } node(){ } node(ll x){ pref = suff = summ = x ; maint() ; } I merge(node &rhs){ ll npref = 0 , nsuff = 0 , nsumm = 0 ; if(summ){ npref = summ + rhs.pref ; } else npref = pref ; if(summ && rhs.summ){ nsumm = summ + rhs.summ ; } if(rhs.summ){ nsuff = rhs.summ + suff ; } else nsuff = rhs.suff ; mxx = max(mxx , suff + rhs.pref) ; pref = npref ; summ = nsumm ; suff = nsuff ; mxx = max(mxx , rhs.mxx) ; maint() ; } } ; node query(ll L , ll R){ ll mn = 0 , mx = 0 ; if(L == R){ MinMax(L , R , mn , mx) ; return node(mn == -1) ; } ll mid = (L + R) >> 1ll ; MinMax(L , R , mn , mx) ; if(mn == -1){ return node(R - L + 1) ; } if(L == R) return node(0) ; node lhs = query(L , mid) ; node rhs = query(mid+1 , R) ; lhs.merge(rhs) ; return lhs ; } long long findGap(int T, int N) { ll st = 0 , en = 1e18 ; ll mn = 0 , mx = 0 ; ll lo = 0, hi = 1e18 ; while(lo<=hi){ ll mid = (lo + hi ) >> 1ll ; MinMax(0 , mid , mx , mx) ; if(mx != -1){ st = mid ; hi = mid -1 ; } else lo = mid + 1; } lo = 0 , hi = 1e18 ; while(lo<=hi){ ll mid = (lo + hi ) >> 1ll ; MinMax(mid , 1e18 , mn , mx ) ; if(mx != -1){ en = mid ; lo = mid +1 ; } else hi = mid - 1; } node answer = query(st , en) ; return answer.mxx + 1; return 0; }

Compilation message (stderr)

gap.cpp: In function 'node query(ll, ll)':
gap.cpp:66:18: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   66 |   MinMax(L , R , mn , mx) ;
      |                  ^~
      |                  |
      |                  ll {aka long long int}
In file included from gap.cpp:2:
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:66:23: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   66 |   MinMax(L , R , mn , mx) ;
      |                       ^~
      |                       |
      |                       ll {aka long long int}
In file included from gap.cpp:2:
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:71:17: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   71 |  MinMax(L , R , mn , mx) ;
      |                 ^~
      |                 |
      |                 ll {aka long long int}
In file included from gap.cpp:2:
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:71:22: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   71 |  MinMax(L , R , mn , mx) ;
      |                      ^~
      |                      |
      |                      ll {aka long long int}
In file included from gap.cpp:2:
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: In function 'long long int findGap(int, int)':
gap.cpp:93:20: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   93 |   MinMax(0 , mid , mx , mx) ;
      |                    ^~
      |                    |
      |                    ll {aka long long int}
In file included from gap.cpp:2:
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:93:25: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
   93 |   MinMax(0 , mid , mx , mx) ;
      |                         ^~
      |                         |
      |                         ll {aka long long int}
In file included from gap.cpp:2:
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:105:23: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
  105 |   MinMax(mid , 1e18 , mn , mx ) ;
      |                       ^~
      |                       |
      |                       ll {aka long long int}
In file included from gap.cpp:2:
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:105:28: error: invalid conversion from 'll' {aka 'long long int'} to 'long long int*' [-fpermissive]
  105 |   MinMax(mid , 1e18 , mn , mx ) ;
      |                            ^~
      |                            |
      |                            ll {aka long long int}
In file included from gap.cpp:2:
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*);
      |                                               ^~~~~~~~~~