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<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 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... |