# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
972991 | bachhoangxuan | Rainforest Jumps (APIO21_jumps) | C++17 | 905 ms | 53076 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;
const int maxl = 20;
int N,H[maxn],P[maxn],lt[maxn],rt[maxn];
int jmp[maxn][maxl],nxt[maxn][maxl],Max[maxn][maxl];
void init(int _N, vector<int> _H) {
N=_N;
for(int i=0;i<N;i++){
H[i+1]=_H[i];
P[H[i+1]]=i+1;
}
vector<int> v;
for(int i=1;i<=N;i++){
while(!v.empty() && H[v.back()]<H[i]) v.pop_back();
rt[i]=(v.empty()?0:v.back());
v.push_back(i);
}
v.clear();
for(int i=N;i>=1;i--){
while(!v.empty() && H[v.back()]<H[i]) v.pop_back();
jmp[i][0]=lt[i]=(v.empty()?0:v.back());
v.push_back(i);
nxt[i][0]=(H[rt[i]]>H[lt[i]]?rt[i]:lt[i]);
Max[i][0]=H[i];
}
for(int i=1;i<18;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... |