# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1047456 | SN0WM4N | 밀림 점프 (APIO21_jumps) | C++14 | 4088 ms | 3528 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "jumps.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> v;
vector<int> m_sig;
void init(int N, std::vector<int> H) {
v = H;
m_sig.resize(N);
int mx = 1e9, idx = -1;
for (int i = N - 1; i >= 0; i --) {
m_sig[i] = i;
for (int j = i; j < N; j ++) {
if (H[j] > H[i]) {
m_sig[i] = j;
break;
}
}
}
}
int minimum_jumps(int A, int B, int C, int D) {
int res = 1e9;
for (int i = A; i <= B; i ++) {
int ans = 0, idx = i;
while (idx < C) {
ans ++;
if (idx == m_sig[idx])
break;
idx = m_sig[idx];
}
if (C <= idx && idx <= D)
res = min(res, ans);
}
if (res == 1e9)
res = -1;
return res;
}
Compilation message (stderr)
# | 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... |