# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
983063 | vjudge1 | Rainforest Jumps (APIO21_jumps) | C++17 | 866 ms | 63952 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>adj[200100];
int vis[200100],d[200100],n,h[200100],rbj[200100][20],obj[200100][20],st[200100][20],loc[200100];
vector<int> v;
int query(int a,int b){
int x=31-__builtin_clz(b-a+1);
return max(st[a][x],st[b-(1<<x)+1][x]);
}
void init(int N, std::vector<int> H) {
stack<int> stk;
for(int i=0;i<N;i++)
loc[st[i+1][0]=h[i+1]=H[i]]=i+1;
h[0]=1e9,n=N;
for(int j=1;j<20;j++) for(int i=1;i+(1<<j)-2<n;i++)
st[i][j]=max(st[i][j-1],st[i+(1<<j-1)][j-1]);
for(int i=0;i<N;i++){
while(stk.size()&&H[stk.top()]<=H[i])
stk.pop();
if(stk.size())
adj[i+1].push_back(stk.top()+1);
stk.push(i);
}
while(stk.size())stk.pop();
for(int i=N;i--;){
while(stk.size()&&H[stk.top()]<=H[i])
stk.pop();
if(stk.size())
adj[i+1].push_back(rbj[i+1][0]=stk.top()+1);
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... |