제출 #95705

#제출 시각아이디문제언어결과실행 시간메모리
95705ShaneOngGap (APIO16_gap)C++14
30 / 100
47 ms1276 KiB
#include "gap.h"
#include<bits/stdc++.h>
using namespace std;

long long findGap(int T, int n){
    long long ans=0ll;
    //if(T==1){
        long long l=0ll,r=1000000000000000000ll;
        MinMax(l,r,&l,&r);
        int temp=2;
        for(int x=0;temp<n;x++){
            long long newl=-1ll,newr=-1ll;
            if(l+1ll<r-1ll)
                MinMax(l+1ll,r-1ll,&newl,&newr);
            if(newl!=-1ll){
                ans=max(ans,max(newl-l,r-newr));
                l=newl;
                r=newr;
            }
            temp+=2;
        }
        if(n==2)
            ans=r-l;
    //}
	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...