Submission #975072

#TimeUsernameProblemLanguageResultExecution timeMemory
975072yoav_sRainforest Jumps (APIO21_jumps)C++17
0 / 100
4054 ms3900 KiB
#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 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...