제출 #1106662

#제출 시각아이디문제언어결과실행 시간메모리
1106662ASN49KGap (APIO16_gap)C++14
70 / 100
46 ms2892 KiB
#include "gap.h"
#include <bits/stdc++.h>
using i64=long long;
const i64 INF=1e18;
long long findGap(int test, int n)
{
    i64 rez=0;
    if (test == 0)
    {

    }
    else
    {
        i64 l,r;
        MinMax(1,INF,&l,&r);
        if(l==r)
        {
            return 0;
        }
        const i64 at_least_gap=(r-l+n-2)/(n-1);
        rez=at_least_gap;
        for(i64 i=l,last=l;i<=r;i+=at_least_gap+1)
        {
            i64 mn,mx;
            MinMax(i,i+at_least_gap,&mn,&mx);
            if(mn!=-1)
            {
                rez=std::max(rez , mn-last);
                last=mx;
            }
        }
    }
	return rez;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...