# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
643747 | colossal_pepe | Rainforest Jumps (APIO21_jumps) | C++17 | 1207 ms | 33332 KiB |
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 <vector>
#include <stack>
#include <algorithm>
using namespace std;
const int INF = 1e9;
int n, k;
vector<int> h, idx;
vector<vector<int>> st_max, st_nxt;
void init(int N, vector<int> H) {
n = N;
h = H;
k = __lg(n) + 1;
idx.resize(n);
for (int i = 0; i < n; i++) {
h[i]--;
idx[h[i]] = i;
}
st_max.resize(k, vector<int>(n));
stack<int> s;
for (int i = 0; i < n; i++) {
while (not s.empty() and s.top() <= h[i]) s.pop();
st_max[0][i] = s.empty() ? h[i] : s.top();
s.push(h[i]);
}
while (not s.empty()) s.pop();
# | 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... |