이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include "gap.h"
#define ll long long
using namespace std;
const ll M = 1e18;
ll l, r, z, p, a, b, sz, f;
long long findGap(int T, int N) {
MinMax(0, M, &a, &b);
if (T == 1) {
if (N == 2) return b-a;
l = a, r = b, f = -1e18;
for (int i=0; i<(N-1)/2; ++i) {
MinMax(l+1, r-1, &a, &b);
f = max(f, a-l);
f = max(f, r-b);
l = a, r = b;
}
return f;
}
l = a+1, r = b, p = a, f = -1e18;
sz = (b-a)/N;
f = sz;
while (l < r) {
z = min(r, l+sz);
MinMax(l, z, &a, &b);
l = z+1;
f = max(f, a-p);
if (b != -1) p = b;
}
return f;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |