# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
48478 | faishol27 | Gap (APIO16_gap) | C++14 | 0 ms | 0 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 "gap.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define PUB push_back
vector<ll>data;
ll kiri=0, kanan=1e18,
rKiri, rKanan;
long long findGap(int T, int N)
{
ll ans = 0;
while(data.size() < N){
MinMax(kiri, kanan, rKiri, rKanan);
kiri = rKiri+1;
kanan = rKanan-1;
data.PUB(kiri);
if(kiri != kanan) data.PUB(kanan);
}
sort(data.begin(), data.end());
for(int i=1;i<N;i++){
ans = max(ans, data[i]-data[i-1]);
}
return ans;
}