| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 84387 | Alexa2001 | Gap (APIO16_gap) | C++17 | 102 ms | 3564 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gap.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll lim = 1e18;
long long findGap(int T, int N)
{
ll *A, *B;
ll ans = 0;
A = new ll(); B = new ll();
if(T == 1)
{
ll x = 0, y = lim;
int i;
for(i=0; i<(N+1)/2; ++i)
{
MinMax(x, y, A, B);
if(i)
{
ans = max(ans, *A - x + 1);
ans = max(ans, y - *B + 1);
}
x = *A + 1;
y = *B - 1;
}
if(N%2==0) ans = max(ans, y-x+2);
return ans;
}
MinMax(0, lim, A, B);
ll X, Y;
X = *A, Y = *B;
ll i, S = (Y-X) / (N-1) + 1;
vector<ll> endpoints;
for(i = 0; i <= Y-X; i += S)
{
MinMax(X+i, X + min(i+S-1, Y-X), A, B);
if(*A == -1) continue;
endpoints.push_back(*A);
endpoints.push_back(*B);
}
endpoints.push_back(Y);
int j;
for(j=0; j<endpoints.size()-1; ++j)
ans = max(ans, endpoints[j+1] - endpoints[j]);
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
