Need help in problem 279C (Ladders)

Правка en1, от kipawa, 2015-06-28 12:37:30

I was solving problem 279C (Ladders)
My logic is to create two arrays inc and dec
inc[i] contains the largest j, such that i<=j and the sequence from ai, ai+1, ..., aj is increasing.
dec[i] contains minimum j, such that i>=j and the sequence from aj, aj+1, ..., ai is decreasing.
Now the sequence l,r is ladder if inc[l-1]==dec[r-1] || inc[l-1]>=r-1 || dec[r-1]<=l-1 (I used 0 based indexing)
I am getting WA on test 20, please help me!
Solution Link
Thanks in advance!

Теги help, 279c, wrong answer

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский kipawa 2015-06-28 12:37:30 736 Initial revision (published)