Submission #838669

#TimeUsernameProblemLanguageResultExecution timeMemory
838669tch1cherinGap (APIO16_gap)C++17
59.04 / 100
45 ms1104 KiB
#include "gap.h" #include <bits/stdc++.h> using namespace std; long long findGap(int T, int N) { long long x, y; MinMax(0, 1e18, &x, &y); long long size = (y - x - 2) / (N - 1); long long left = x + 1; long long gap = 0, max_pos = x; while (left < y) { long long right = min(y - 1, left + size - 1); long long Min, Max; MinMax(left, right, &Min, &Max); if (Min != -1) { gap = max(gap, Min - max_pos); max_pos = Max; } left += size; } return max(gap, y - max_pos); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...