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 <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>
using namespace std;
typedef long long ll;
const ll INF = 1e18 + 239;
ll findGap(int T, int N) {
ll F, S;
MinMax((ll)0, INF, &F, &S);
vector<ll> v;
while (F != -1 && F != S) {
v.push_back(F);
v.push_back(S);
ll nF, nS;
MinMax(F + 1, S - 1, &nF, &nS);
F = nF;
S = nS;
// cerr << "nw " << F << ' ' << S << endl;
}
if (F == S && F != -1) v.push_back(F);
sort(v.begin(), v.end());
ll ans = 0;
for (int i = 0; i + 1 < N; i++) {
ans = max(ans, v[i + 1] - v[i]);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |