# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
464017 | prvocislo | 밀림 점프 (APIO21_jumps) | C++17 | 1764 ms | 47936 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "jumps.h"
#include <vector>
using namespace std;
const int logn = 19, maxn = 2e5+5;
//const int logn = 19, maxn = 10;
int jumpl[logn][maxn], jumpr[logn][maxn], high[logn][maxn];
int n, top, h[maxn], stk[maxn];
void init(int N, vector<int> H)
{
n = N, top = 0;
for (int i = 1; i <= n; i++) h[i] = H[i - 1];
for (int i = 1; i <= n; i++)
{
while (top && h[stk[top - 1]] < h[i]) jumpr[0][stk[top - 1]] = i, top--;
if (top) jumpl[0][i] = stk[top - 1];
stk[top++] = i;
}
for (int i = 1; i <= n; i++)
{
int l = jumpl[0][i], r = jumpr[0][i];
if (!r || (l && r && h[l] > h[r])) high[0][i] = l;
else high[0][i] = r;
}
for (int l = 1; l < logn; l++) for (int i = 1; i <= n; i++)
{
jumpl[l][i] = jumpl[l - 1][jumpl[l - 1][i]];
jumpr[l][i] = jumpr[l - 1][jumpr[l - 1][i]];
high[l][i] = high[l - 1][high[l - 1][i]];
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |