# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1059290 | VMaksimoski008 | Rainforest Jumps (APIO21_jumps) | C++17 | 4027 ms | 67016 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;
const int maxn = 2e5 + 5;
int n, L[maxn][20], R[maxn][20], up[maxn][20], up2[maxn][20], sub1 = 1;
vector<int> v;
void init(int N, vector<int> H) {
n = N;
v.push_back(1e9);
for(int &x : H) v.push_back(x);
v.push_back(1e9);
stack<pair<int, int> > st; st.push({ 1e9, 0 });
for(int i=1; i<=n; i++) {
if(v[i] != i) sub1 = 0;
while(!st.empty() && st.top().first <= v[i]) st.pop();
L[i][0] = st.top().second;
st.push({ v[i], i });
}
while(!st.empty()) st.pop();
st.push({ 1e9, n + 1 });
for(int i=n; i>=1; i--) {
while(!st.empty() && st.top().first <= v[i]) st.pop();
R[i][0] = st.top().second;
st.push({ v[i], 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... |