이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
using ll = long long;
#define all(x) begin(x), end(x)
const ll MAX_A = 1e18;
ll findGap(int T, int N) {
ll mini = -1, maxi = MAX_A + 1;
int q = (N + 1) / 2;
vector<ll> a(N);
int i = 0, j = N - 1;
while (i <= j) {
MinMax(mini + 1, maxi - 1, &mini, &maxi);
assert(mini != -1), assert(maxi != -1);
a[i++] = mini, a[j--] = maxi;
}
ll maxGap = 0LL;
for (int i = 1; i < N; i++) {
maxGap = max(maxGap, a[i] - a[i - 1]);
}
return maxGap;
}
컴파일 시 표준 에러 (stderr) 메시지
gap.cpp: In function 'll findGap(int, int)':
gap.cpp:14:9: warning: unused variable 'q' [-Wunused-variable]
14 | int q = (N + 1) / 2;
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |