Submission #95588

#TimeUsernameProblemLanguageResultExecution timeMemory
95588jeffGap (APIO16_gap)C++14
48.54 / 100
66 ms1300 KiB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;

long long findGap(int T, int N) {
    long long l, r, y, z, iv, ls = -1, rs = 0, a, b = 0, i;
    MinMax(0, 1000000000000000000, &l, &r);
    y = l;
    z = r;
    iv = max((r - l) / N, 1LL);
    for (i = 0; b < z; ++i) {
        a = y + i * iv;
        b = y + (i + 1) * iv;
        MinMax(a, b, &l, &r);
        if (l < 0 && r < 0) continue;
        if (ls > -1) rs = max(rs, l - ls);
        ls = r;
    }
	return rs;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...