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 <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> v;
typedef vector<v> vv;
typedef vector<vv> vvv;
typedef pair<ll, ll> p;
typedef vector<p> vp;
typedef vector<vp> vvp;
typedef vector<vvp> vvvp;
typedef pair<ll, p> tri;
typedef vector<tri> vtri;
typedef vector<vtri> vvtri;
typedef vector<vvtri> vvvtri;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<vvb> vvvb;
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
const ll INF = 1e18;
const ll mod = 1e9 + 7;
#include "jumps.h"
v H;
ll N;
v nextHigher;
v height;
v st;
ll n;
void init(int Nn, vector<int> Hh)
{
N = Nn;
H = v();
for (auto x : Hh) H.pb(x);
}
int minimum_jumps(int A, int B, int C, int D)
{
ll res = INF;
for (ll i = A; i <= B; i++)
{
for (ll j = C; j <= D; j++)
{
ll amt = 0;
ll cur = i;
while (cur < j)
{
ll next = cur;
while (next < N && H[next] <= H[cur]) next++;
cur = next;
amt++;
}
if (cur == j) res = min(res, amt);
}
}
if (res == INF) return -1;
return res;
}
# | 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... |