Submission #266602

#TimeUsernameProblemLanguageResultExecution timeMemory
266602dCodingGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; #define F0R(i,n) for(int i = 0; i < (n); i++) #define FOR(i,a,b) for(int i = (a); i <= (b); i++) #define ll long long #define pb push_back long long findGap(int T, int N) { vector<ll> a; ll lo = 0, hi = 1e18; while((int)a.size() < N) { ll &mn,&mx; MinMax(lo,hi,mn,mx); if(mn == mx) { a.pb(mn); } else { a.pb(mn); a.pb(mx); hi = mx-1; lo = mn+1; assert(lo <= hi); } } ll ans = 0; sort(a.begin(),a.end()); FOR(i,1,N-1) ans = max(ans,a[i]-a[i-1]); return ans; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:14:17: error: 'mn' declared as reference but not initialized
   14 |             ll &mn,&mx;
      |                 ^~
gap.cpp:14:21: error: 'mx' declared as reference but not initialized
   14 |             ll &mn,&mx;
      |                     ^~
gap.cpp:15:26: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   15 |             MinMax(lo,hi,mn,mx);
      |                          ^~
      |                          |
      |                          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:15:29: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   15 |             MinMax(lo,hi,mn,mx);
      |                             ^~
      |                             |
      |                             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*);
      |                                               ^~~~~~~~~~