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;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <int, pii> pip;
typedef pair <pii, int> ppi;
typedef pair <ll, ll> pll;
pii query(ll a, ll b) {
if (a>b) return mp(-1, -1);
ll x, y;
// printf("[%lld, %lld]\n", a, b);
MinMax(a, b, &x, &y);
return mp(x, y);
}
long long findGap(int T, int N) {
ll sol=0;
pll pp=query(0, 1e18);
N-=2;
while (N>=1) {
pll curr=query(pp.X+1, pp.Y-1);
sol=max(sol, curr.X-pp.X);
sol=max(sol, pp.Y-curr.Y);
pp=curr;
N-=2;
}
sol=max(sol, pp.Y-pp.X);
return sol;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |