Submission #249290

#TimeUsernameProblemLanguageResultExecution timeMemory
249290sahil_kGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include <iostream> 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); ans = min(ans, mn-p_mn); 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:6:3: error: expected initializer before 'long'
   long long p_mn = 0, p_mx = 1e18;
   ^~~~
gap.cpp:9:11: error: 'p_mn' was not declared in this scope
    MinMax(p_mn+1, p_mx-1, mn, mx);
           ^~~~
gap.cpp:9:11: note: suggested alternative: 'mn'
    MinMax(p_mn+1, p_mx-1, mn, mx);
           ^~~~
           mn
gap.cpp:9:19: error: 'p_mx' was not declared in this scope
    MinMax(p_mn+1, p_mx-1, mn, mx);
                   ^~~~
gap.cpp:9:31: error: 'mx' was not declared in this scope
    MinMax(p_mn+1, p_mx-1, mn, mx);
                               ^~
gap.cpp:9:31: note: suggested alternative: 'mn'
    MinMax(p_mn+1, p_mx-1, mn, mx);
                               ^~
                               mn
gap.cpp:9:4: error: 'MinMax' was not declared in this scope
    MinMax(p_mn+1, p_mx-1, mn, mx);
    ^~~~~~