# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
70601 | polyfish | Gap (APIO16_gap) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//I love armpit fetish
#include <bits/stdc++.h>
#include "gap.h"
using namespace std;
#define debug(x) cerr << #x << " = " << x << '\n';
#define BP() cerr << "OK!\n";
#define PR(A, n) {cerr << #A << " = "; for (int _=1; _<=n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define PR0(A, n) {cerr << #A << " = "; for (int _=0; _<n; ++_) cerr << A[_] << ' '; cerr << '\n';}
#define FILE_NAME "data"
const int64_t INF = 1e18;
const int MAX_N = 100002;
int n;
int64_t a[MAX_N];
int64_t solve_subtask_1() {
int l = 1, r = n;
int64_t s = 1, t = INF;
while (l<=r) {
int64_t *mn;
int64_t *mx;
MinMax(s, t, mn, mx);
a[l] = *mn;
a[r] = *mx;
s = *mn + 1;
t = *mx - 1;
}
int64_t res = 0;
for (int i=2; i<=n; ++i)
res = max(res, a[i] - a[i-1]);
return res;
}
int64_t findGap(int testID, int N) {
n = N;
if (testID==1)
return solve_subtask_1();
return 0;
// else
// return solve_subtask_2();
}