This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb(e) push_back(e)
#define sv(a) sort(a.begin(),a.end())
#define sa(a,n) sort(a,a+n)
#define mp(a,b) make_pair(a,b)
#define vf first
#define vs second
#define ar array
#define all(x) x.begin(),x.end()
long long findGap(int t, int n)
{
ll arr[n];
memset(arr,0,sizeof arr);
ll l = 0 , r = 1000000000000000000;
int i = 0 , j = n - 1;
ll x , y;
while(i <= j){
MinMax(l , r , &x , &y);
arr[i] = x;
arr[j] = y;
l = x + 1;
r = y - 1;
i++;
j--;
}
ll ans = 0;
for(i = 0; i < n-1; i++){
ans = max(ans , arr[i+1]-arr[i]);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |