이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include <iostream>
#include <vector>
using namespace std;
long long findGap(int T, int N) {
vector<long long> a = {};
vector<long long> a_sec = {};
long long l = 0;
long long r = 1e18;
while (l < r) {
// cout << l << " " << r << endl;
long long mn, mx;
MinMax(l, r, &mn, &mx);
if (mn == -1) break;
a.push_back(mn);
if (mn != mx) a_sec.push_back(mx);
l = mn + 1;
r = mx - 1;
}
for (int i = a_sec.size() - 1; i >= 0; i --) {
a.push_back(a_sec[i]);
}
// for (auto aa: a) {
// cout << aa << " ";
// }
// cout << endl;
long long res = -1;
for (int i = 0; i < N - 1; i ++) {
res = max(res, a[i + 1] - a[i]);
}
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |