Submission #249294

#TimeUsernameProblemLanguageResultExecution timeMemory
249294sahil_kGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include "gap.h" using namespace std; long long flipgap (int t, int n) { if (t == 1) { long long mn, mx; long long p_mn = 0, p_mx = 1e18; long long ans = 1e18; for (int i=0; i<(n+1)/2; i++) { MinMax(p_mn+1, p_mx-1, mn, mx); if (mn > -1) ans = min(ans, mn-p_mn); if (mx > -1) ans = min(ans, p_mx-mx); p_mn = mn; p_mx = mx; } return ans; } else { return 0; } }

Compilation message (stderr)

gap.cpp: In function 'long long int flipgap(int, int)':
gap.cpp:9:33: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    MinMax(p_mn+1, p_mx-1, mn, mx);
                                 ^
In file included from gap.cpp:1:0:
gap.h:1:6: note:   initializing argument 3 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^~~~~~
gap.cpp:9:33: error: invalid conversion from 'long long int' to 'long long int*' [-fpermissive]
    MinMax(p_mn+1, p_mx-1, mn, mx);
                                 ^
In file included from gap.cpp:1:0:
gap.h:1:6: note:   initializing argument 4 of 'void MinMax(long long int, long long int, long long int*, long long int*)'
 void MinMax(long long, long long, long long*, long long*);
      ^~~~~~
gap.cpp:10:23: error: 'min' was not declared in this scope
    if (mn > -1) ans = min(ans, mn-p_mn);
                       ^~~
gap.cpp:10:23: note: suggested alternative: 'mn'
    if (mn > -1) ans = min(ans, mn-p_mn);
                       ^~~
                       mn
gap.cpp:11:23: error: 'min' was not declared in this scope
    if (mx > -1) ans = min(ans, p_mx-mx);
                       ^~~
gap.cpp:11:23: note: suggested alternative: 'mn'
    if (mx > -1) ans = min(ans, p_mx-mx);
                       ^~~
                       mn