# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
858358 | chanhchuong123 | Rainforest Jumps (APIO21_jumps) | C++14 | 816 ms | 45416 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 <bits/stdc++.h>
using namespace std;
#define task ""
const int MAX = 200020;
int n, q;
int H[MAX];
stack<int> st;
int dp[18][MAX], rg[18][MAX], hi[18][MAX];
#define combine(x, y) (H[(x)] < H[(y)] ? y : x)
void init(int N, vector<int> _H) {
n = N;
for (int i = 0; i < n; ++i) {
H[i + 1] = _H[i];
}
H[0] = H[n + 1] = n + 1; st.push(0);
for (int i = 1; i <= n; ++i) {
while (H[st.top()] < H[i]) st.pop();
hi[0][i] = st.top(); st.push(i);
}
st.push(n + 1); rg[0][0] = rg[0][n + 1] = n + 1;
for (int i = n; i >= 1; --i) {
while (H[st.top()] < H[i]) st.pop();
rg[0][i] = st.top(); st.push(i);
}
for (int i = 1; i <= n; ++i) {
dp[0][i] = i;
hi[0][i] = combine(hi[0][i], rg[0][i]);
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... |