Submission #718661

#TimeUsernameProblemLanguageResultExecution timeMemory
718661lamRainforest Jumps (APIO21_jumps)C++14
4 / 100
914 ms14468 KiB
#include "jumps.h" #include <bits/stdc++.h> #include <vector> using namespace std; const int maxn = 2e5 + 10; int n,d[maxn]; int a[maxn]; vector <int> adj[maxn]; void addedge(int u, int v) { adj[u].push_back(v); } void init(int N, std::vector<int> H) { n=N; for (int i=0; i<n; i++) a[i]=H[i],adj[i].clear(); deque<int> dq; for (int i=0; i<n; i++) { while (!dq.empty()&&a[dq.back()] < a[i]) dq.pop_back(); if (!dq.empty()) addedge(i,dq.back()); dq.push_back(i); } while (!dq.empty()) dq.pop_back(); for (int i=n-1; i>=0; i--) { while (!dq.empty()&&a[dq.back()] < a[i]) dq.pop_back(); if (!dq.empty()) addedge(i,dq.back()); dq.push_back(i); } } int minimum_jumps(int A, int B, int C, int D) { return C-B; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...