Submission #1149734

#TimeUsernameProblemLanguageResultExecution timeMemory
1149734vladiliusGap (APIO16_gap)C++20
0 / 100
40 ms1204 KiB
#include <bits/stdc++.h> #include "gap.h" using namespace std; using ll = long long; using pii = pair<int, int>; #define pb push_back #define ff first #define ss second const ll inf = 1e18; ll findGap(int T, int n){ ll l, r; MinMax(0, inf, &l, &r); if ((r - l + 1) == n) return 1; ll M = r, f = ceil(1.0 * (r - l) / (n - 1)), k = l, P = k, out = 0; while (k < M){ MinMax(k + 1, k + f - 1, &l, &r); if (l == -1){ k += f; } else { out = max(out, l - P); P = k = r; } } out = max(out, (M - P)); return out; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...