이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
const int MAX = 1e18;
int findGap(signed T, signed N) {
// cout << T << ' ' << N << endl;
int l = 0;
int r = MAX;
MinMax(l, r, &l, &r);
int ans = 0;
while (r != l) {
if (r - l == 1) {
ans = max(ans, r - l);
break;
}
int nl;
int nr;
MinMax(l + 1, r - 1, &nl, &nr);
if (nl != -1) {
ans = max(ans, r - nr);
ans = max(ans, nl - l);
} else {
ans = max(ans, r - l);
}
r = nr;
l = nl;
// cout << r << ' ';
}
// cout << endl;
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |