Brandon983's blog

By Brandon983, history, 6 years ago, In English

Hi, I'm really perplexed by this problem. If anyone could give me pointers, that would be greatly appreciated.

My submission is http://codeforces.com/contest/446/submission/33328941 and it failed on problem 41. I'm really confused on how the answer could be 4. The possible subsegments of length 4 created from [7 2 3 1 4 5] are [7 2 3 1] [2 3 1 4] [3 1 4 5] and none of them can be turned into strictly increasing arrays when changing only up to one element.

Maybe I totally misinterpreted the problem but if that's the case, I don't know how I manged to get 40 problems correct...

  • Vote: I like it
  • 0
  • Vote: I do not like it

| Write comment?
»
6 years ago, # |
  Vote: I like it 0 Vote: I do not like it

In this problem you need to find the maximum length of subsegment which will be an increasing subsegment after removal of one element. In the above case:

[7 2 3 1 4 5] — > [2 3 1 4 5]

Here, after removing 1 you get an increasing subsegment [2 3 4 5] so the answer should be 4.

»
6 years ago, # |
Rev. 2   Vote: I like it +5 Vote: I do not like it

You can change 3 to 0 and it will be a strictly increasing sequence of length 4.

[0 1 4 5]