# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
263755 | T0p_ | 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 <bits/stdc++.h>
#include "gap.h"
using namespace std;
vector<long long> v;
long long findGap(int m, int n)
{
if(m == 1)
{
int left = n-2;
long long s = 0, t = 1e18, mn, mx;
MinMax(s, t, &mn, &mx);
v.push_back(mn);
v.push_back(mx);
s = mn+1;
t = mx-1;
while(true)
{
MinMax(s, t, &mn, &mx);
v.push_back(mn);
left--;
if(!left) break ;
v.push_back(mx);
left--;
if(!left) break ;
s = mn+1, t = mx-1;
}
assert(v.size() == n);
sort(v.begin(), v.end());
for(int i=1 ; i<v.size() ; i++)
ans = max(ans, v[i] - v[i-1]);
return ans;
}
else
{
}
}