| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 83784 | popovicirobert | Gap (APIO16_gap) | C++14 | 83 ms | 2268 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#define ll long long
#include <bits/stdc++.h>
using namespace std;
const int MAXN = (int) 1e5;
const ll INF = 1e18;
ll arr[MAXN + 1];
long long findGap(int T, int N) {
ll A, B;
if(T == 1) {
ll ans = 0;
A = 0;
B = INF;
for(int i = 1; i <= N - i + 1; i++) {
ll mn, mx;
MinMax(A, B, &arr[i], &arr[N - i + 1]);
A = arr[i] + 1;
B = arr[N - i + 1] - 1;
}
for(int i = 1; i < N; i++) {
ans = max(ans, arr[i + 1] - arr[i]);
}
return ans;
}
MinMax(0, INF, &A, &B);
ll dif = (B - A + N - 2) / (N - 1);
ll cur = A, ans = dif;
while(cur < B) {
ll s, t, mn, mx;
s = t = cur + 1;
do {
t += dif;
if(t > B) {
t = min(t, B);
}
MinMax(s, t, &mn, &mx);
if(mx == -1) {
continue;
}
else {
break;
}
}while(1);
ans = max(ans, mn - cur);
dif = max(dif, ans);
cur = mx;
//cerr << cur << " ";
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
