Submission #984149

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9841492024-05-16 10:45:57Alkaser_IDRainforest Jumps (APIO21_jumps)C++17
4 / 100
4024 ms17192 KiB
#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.upper_bound(v[i].second);
if(it != s.end()){
nxup[v[i].second] = *it;
}
if(it != s.begin()){
--it;
lsup[v[i].second] = *it;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...