Submission #47674

#TimeUsernameProblemLanguageResultExecution timeMemory
47674tieunhiGap (APIO16_gap)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; long long findGap(int T, int N) { long long mn, mx, mmn, mmx; MinMax(0, 2e18, &mn, &mx); long long res = 0; if (T == 1) { for (int i = 0; i < (n+1)/2; i++) { MinMax(mn+1, mx-1, &mmn, &mmx); if (mmn == -1) break; res = max({res, mmn-mn, mx-mmx}); } } else { long long sz = (mx - mn)/N; long long last = mn; for (long long b = mn+1, e = mn+sz; ; b += sz, e += sz) { if (e >= mx) e = mx - 1; if (b > e) break; MinMax(b, e, &mmn, &mmx); if (mmn == -1) continue; res = max(res, mmn - last); last = mmx; } res = max(res, mx - last); } return res; }

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:13:30: error: 'n' was not declared in this scope
         for (int i = 0; i < (n+1)/2; i++)
                              ^