Submission #321103

#TimeUsernameProblemLanguageResultExecution timeMemory
321103MetBGap (APIO16_gap)C++14
60.00 / 100
75 ms1276 KiB
#include "gap.h" #include <bits/stdc++.h> typedef long long ll; typedef long double ld; using namespace std; ll findGap(int T, int N) { ll mn, mx; MinMax (1, 1e18, &mn, &mx); ll s = mn, e = mx; ld d = (ld) (mx - mn - 2) / N; ld l = mn + 1, r = mn + 1 + d; ll gap = 0, mx_old = mn; for (int i = 0; i < N - 1; i++) { ll il = ceil (l - 1e-7) + (ceil (l + 1e-7) == mx_old), ir = floor (r + 1e-7); //cout << il << ' ' << ir << endl; MinMax(il, ir, &mn, &mx); //cout << ' ' << mn << ' ' << mx << endl; if (mn != -1) { gap = max (gap, mn - mx_old); mx_old = mx; } l += d, r += d; } ll il = ceil (l - 1e-7) + (ceil (l + 1e-7) == mx_old), ir = floor (r + 1e-7); //cout << il << ' ' << ir << endl; MinMax(il, ir, &mn, &mx); //cout << ' ' << mn << ' ' << mx << endl; if (mn != -1) { gap = max (gap, mn - mx_old); mx_old = mx; } gap = max (gap, e - mx_old); return gap; }

Compilation message (stderr)

gap.cpp: In function 'll findGap(int, int)':
gap.cpp:15:5: warning: unused variable 's' [-Wunused-variable]
   15 |  ll s = mn, e = mx;
      |     ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...