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;
int n;
vector <int> a;
void init(int N, vector<int> H)
{
n = N;
a = H;
}
int minimum_jumps(int A, int B, int C, int D)
{
int cnt = 0, cur = A;
if (A < C)
{
for (int i = A; i <= C; i++)
{
if (a[cur] >= a[C])
{
return -1;
}
if (a[cur] < a[i])
{
cur = i;
cnt++;
}
}
return cnt;
}
else
{
for (int i = A; i >= C; i--)
{
if (a[cur] >= a[C])
{
return -1;
}
if (a[cur] < a[i])
{
cur = i;
cnt++;
}
}
return cnt;
}
return -1;
}
# | 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... |