제출 #970812

#제출 시각아이디문제언어결과실행 시간메모리
970812vjudge1Gap (APIO16_gap)C++14
30 / 100
34 ms4012 KiB
#include "gap.h"

#include <bits/stdc++.h>

using namespace std;

#define int long long

long long findGap(int32_t T, int32_t N)
{
   int pl=0, pr=1e18;
   vector<int> a;
   while (N>0){
      int l, r;
      MinMax(pl, pr, &l, &r);
      a.push_back(l);
      if (l!=r) a.push_back(r);
      pl=l+1;
      pr=r-1;
      N-=2;
   }
   sort(a.begin(), a.end());
   int ans=0;
   for (int i=1; i<(int)a.size(); ++i) ans=max(ans, a[i]-a[i-1]);
   return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...