# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
182418 | | AQT | Gap (APIO16_gap) | C++14 | | 2065 ms | 2036 KiB |
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 <bits/stdc++.h>
#include "gap.h"
using namespace std;
long long arr[100005];
long long findGap(int T, int N){
if(T == 1){
int l = 1, r = N;
long long lstl = -1, lstr = 1000000000000000001LL;
while(l <= r){
MinMax(lstl+1, lstr-1, &lstl, &lstr);
arr[l++] = lstl, arr[r--] = lstr;
}
long long ans = 0;
for(int i = 2; i<=N; i++){
ans = max(ans, arr[i]-arr[i-1]);
}
return ans;
}
fill(arr+1, arr+1+N, -1);
long long s, e;
MinMax(0, 1000000000000000000LL, &s, &e);
long long d = (e-s)/(N-1);
arr[1] = s, arr[N] = e;
long long lst = s;
long long ans = 0;
while(s < e){
long long t;
MinMax(s+1, s+d, &s, &t);
ans = max(ans, s-lst);
lst = s = t;
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |