# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
984180 | Alkaser_ID | Rainforest Jumps (APIO21_jumps) | C++17 | 666 ms | 17212 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"
using namespace std;
#include <bits/stdc++.h>
bool sb1 = true;
int n, dp[200005], ad[200005], a[200005];
int nxup[200005],nxls[200005],lsup[200005];
void init(int N, std::vector<int> H) {
n = N;
for(int i=0;i<n;++i) a[i] = H[i];
for(int i=1;i<n;++i){
if(a[i] < a[i-1]) sb1 = false;
}
vector<pair<int,int>> v;
for(int i=0;i<n;++i){
v.push_back({H[i],i});
}
sort(v.begin(),v.end(),greater<pair<int,int>>());
for(int i=0;i<n;++i) nxup[i] = nxls[i] = lsup[i] = -1;
set<int> s;
for(int i=0;i<n;++i) {
if(!s.empty()){
set<int>::iterator it= s.lower_bound(v[i].second);
if(it != s.end()){
nxup[v[i].second] = *it;
}
if(it != s.begin()){
--it;
lsup[v[i].second] = *it;
Compilation message (stderr)
# | 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... |