Submission #340851

#TimeUsernameProblemLanguageResultExecution timeMemory
340851super_j6Gap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" #include <iostream> #include <cstdio> #include <algorithm> using namespace std; #define endl '\n' #define ll long long #define pi pair<int, int> #define f first #define s second /* const int mxn = 100000; int t, n; ll a[mxn]; void MinMax(ll l, ll r, ll &x, ll &y){ l = lower_bound(a, a + n, l) - a; r = upper_bound(a, a + n, r) - a - 1; if(l > r) x = -1, y = -1; else x = a[l], y = a[r]; } */ ll findGap(int t, int n){ ll l, r, ret = 0; MinMax(0, 1e18, l, r); if(n == 2) return r - l; for(ll i = l + 1, d = 2 * (r - l - 1) / (n - 2); i < r; i += d){ ll x, y; MinMax(i, i + d - 1, x, y); if(~x && ~y) ret = max({ret, x - l, y - x}), l = y; } ret = max(ret, r - l); return ret; } /* int main(){ ios::sync_with_stdio(0); cin.tie(0); cin >> t >> n; for(int i = 0; i < n; i++) cin >> a[i]; cout << findGap(t, n) << endl; return 0; } */

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:25:18: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   25 |  MinMax(0, 1e18, l, r);
      |                  ^
      |                  |
      |                  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:25:21: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   25 |  MinMax(0, 1e18, l, r);
      |                     ^
      |                     |
      |                     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:29:24: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   29 |   MinMax(i, i + d - 1, x, y);
      |                        ^
      |                        |
      |                        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:29:27: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
   29 |   MinMax(i, i + d - 1, x, y);
      |                           ^
      |                           |
      |                           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*);
      |                                               ^~~~~~~~~~