Submission #569013

#TimeUsernameProblemLanguageResultExecution timeMemory
569013kikokiRainforest Jumps (APIO21_jumps)C++17
0 / 100
754 ms2064 KiB
#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 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...