Submission #1051964

#TimeUsernameProblemLanguageResultExecution timeMemory
1051964user736482Rainforest Jumps (APIO21_jumps)C++17
4 / 100
562 ms4284 KiB
#include<bits/stdc++.h> using namespace std; int lft[200007],rgt[200007]; bool czy1=1; void init(int n,vector<int>v){ stack<int>s; lft[200006]=200006; rgt[200006]=200006; //s.push(n); for(int i=0;i<n;i++){ lft[i]=200006; rgt[i]=200006; } //return; for(int i=0;i<n;i++){ if(s.empty() || v[s.top()]>v[i]) s.push(i); else{ rgt[s.top()]=i; s.pop(); i--; } } while(s.size()>0) s.pop(); for(int i=n-1;i>=0;i--){ if(s.empty() || v[s.top()]>v[i]) s.push(i); else{ czy1=0; lft[s.top()]=i; s.pop(); i++; } } //for(int i=0;i<n;i++) //cout<<lft[i]<<" "<<rgt[i]<<"\n"; } int minimum_jumps(int a,int b,int c,int d){ if(czy1) return c-b; return 2137; }
#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...