Doubt in CSES Problem(Traffic Lights)

Revision en1, by akashAgrawal, 2020-11-22 16:41:43

Problem — https://cses.fi/problemset/task/1163 13

I am not getting this problem. I think the sample output is incorrect!

Input: 8 3 3 6 2

Output: 5 3 3

According to the sample, the input answer should be: 5 3 2 but the sample output is 5 3 3

Demonstration:

0 1 2 3 4 5 6 7 8 ! ! ! I mean after adding 2 how the longest path without traffic light is 3 and not 2? Somebody, please help. Is there a catch that I am losing?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English akashAgrawal 2020-11-22 16:41:43 495 Initial revision (published)