# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
629891 | hy_1 | 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 <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <cmath>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <unordered_map>
#define ll long long
long long findGap(int T, int N){
ll n = N;
vector<ll> arr(n);
ll l =1 , r = 1e18;
while(arr.size() < n){
ll mn , mx;
MinMax(l , r , mn , mx);
arr.push_back(mn);
if(mn != mx){
arr.push_back(mx);
}
l += 1;
r -= 1;
}
ll ans = 0;
for(int i =0; i<n-1; i++){
ll y = arr[i+1] - arr[i];
// ans = max(ans , y);
if(y > ans) ans = y;
}
return ans;
}