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 <cmath>
#include <functional>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <cassert>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>
#include <numeric>
#include "gap.h"
using namespace std;
long long findGap(int t, int n)
{
long long ST = 0;
long long DR = (long long)1e18;
MinMax(ST, DR, &ST, &DR);
vector<long long> a(n);
for (int i = 0; i <= n - 1 - i; i++)
{
int j = n - 1 - i;
a[i] = ST;
a[j] = DR;
MinMax(ST + 1, DR - 1, &ST, &DR);
}
long long best_gap = a[1] - a[0];
for (int i = 0; i + 1 < n; i++)
{
best_gap = max(best_gap, a[i + 1] - a[i]);
}
return best_gap;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |