Submission #115435

#TimeUsernameProblemLanguageResultExecution timeMemory
115435nvmdavaGap (APIO16_gap)C++17
0 / 100
2053 ms3056 KiB
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;

long long findGap(int T, int N)
{
    long long s, t;
    MinMax(1, 1000000000000000000, &s, &t);
    long long l, r;
    l = s + 1;
    long long sz = (r - l + 1) / N;
    long long lf = s, res = 0;
    long long a, b;
    while(l < t){
        r = l + sz;
        MinMax(l, r, &a, &b);
        if(a != -1) res = max(res, a - lf);
        if(b != -1) lf = b;
        if(a != -1) res = max(res, b - a);
        l = r + 1;
    }
    res = max(res, t - lf);
	return res;
}

Compilation message (stderr)

gap.cpp: In function 'long long int findGap(int, int)':
gap.cpp:11:23: warning: 'r' is used uninitialized in this function [-Wuninitialized]
     long long sz = (r - l + 1) / N;
                     ~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...