제출 #545754

#제출 시각아이디문제언어결과실행 시간메모리
545754AJ00Gap (APIO16_gap)C++14
0 / 100
46 ms1108 KiB
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
long long int findGap(int T, int n){
    long long int f = 0,r=1e18,i=0,mn,mx,ans=0;
    while((i<(n/2))){
        MinMax(f,r,&mn,&mx);
       // cout << mn << " " << mx << "\n";
        if (i){
            ans = max(ans,mn-f+1);
            ans = max(ans,r-mx+1);
        }
        i++;
        f = mn+1;
        r = mx-1;
    }    
    if (n%2==1){
        MinMax(f,r,&mn,&mx);
      //  cout << mn << " " << mx << "\n";
        ans = max(ans,mn-f+1);
        ans = max(ans,r-mx+1);
    }
    return ans;
   // cout << mn << " " << mx << "\n";
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...