Submission #489787

#TimeUsernameProblemLanguageResultExecution timeMemory
489787andydexterGap (APIO16_gap)C++14
0 / 100
33 ms1176 KiB
#include "gap.h"
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
 
long long findGap(int T, int N)
{
    ll mx,mn;
    MinMax(0,1000000000000000000,&mn,&mx);
    ll interval = (mx-mn)/(N-1);
    ll lowest = mn, highest = mx;
    ll lower = lowest,lastmx = 0;
    while(lower<=highest){
        MinMax(lower,lower+interval,&mn,&mx);
        if(mn>-1){
            interval = max(interval,mn-lastmx);
            lastmx = mx;
        }
        lower += interval+1;
    }
	return interval;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...