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>
#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 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... |