Блог пользователя Manurung

Автор Manurung, 10 лет назад, По-английски

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://codeforces.me/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?

Теги dp
  • Проголосовать: нравится
  • -2
  • Проголосовать: не нравится

»
10 лет назад, # |
Rev. 4   Проголосовать: нравится +4 Проголосовать: не нравится

In case Data[a + 1] - Data[a - 1] > 1 change Data[a] to Data[a - 1] + 1, we have new sequence with length kiri[a - 1] + kanan[a + 1] + 1

Otherwise:

  • Change Data[a] to Data[a - 1] + 1, we have length kiri[a - 1] + 1

  • Change Data[a] to Data[a + 1] - 1, we have length kanan[a + 1] + 1

You forgot these 2 cases.

I change your code a bit and got AC: 7149106