First i want to say sorry because i make a new post for my question, and not make it in the comment of the editorial codeforces round FF.
I need help with 446A. Here's my code: http://mirror.codeforces.com/contest/447/submission/7148685
My approach is the following.
- Count the length of the sequence (left & right) for each index i until (n-1), while i start from 0 and n is the number of element. - i know that the result of the sequence would be like this (something that increasing) + element that can be changed + (something that increasing). - After that i just count the length of the sequence for each index.
I get WA on the 5th test, it's too big for me to analyse it (I can't even get access to the full example), nor I can get access to the full test data. Would this approach satisfy the time limits, and where is my mistake?
In case
Data[a + 1] - Data[a - 1] > 1
changeData[a]
toData[a - 1] + 1
, we have new sequence with lengthkiri[a - 1] + kanan[a + 1] + 1
Otherwise:
Change
Data[a]
toData[a - 1] + 1
, we have lengthkiri[a - 1] + 1
Change
Data[a]
toData[a + 1] - 1
, we have lengthkanan[a + 1] + 1
You forgot these 2 cases.
I change your code a bit and got AC: 7149106