Submission #245401

#TimeUsernameProblemLanguageResultExecution timeMemory
245401neihcr7jGap (APIO16_gap)C++14
30 / 100
71 ms2044 KiB
#include<bits/stdc++.h>
#include "gap.h"

#define maxn 100005

using namespace std;
typedef long long ll;

ll findGap(int T, int n) {
  ll l = 0, r = 1000000000000000000;

  int i = 1, j = n;
  vector < ll > a(n + 1);

  while (i <= j) {
    ll x, y;

    MinMax(l, r, &x, &y);
    a[i] = x;
    a[j] = y;
    i ++;
    j --;
    l = x + 1;
    r = y - 1;
  }

  ll ma = 0;
  for (int i = 2; i <= n; ++i)
    ma = max(ma, a[i] - a[i - 1]);

  return ma;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...