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?
6-3=3
So the longest passage is 3, not 2.But we have put a tower on 6 so why we are also taking 6 in answer, my point is that on 4 and 5 there will not be any tower but on 6 there will be a tower and on 3 also there will be tower too
Got it at last. The problem is about the distance free of the traffic lights, not about the consecutive number of points free of the traffic lights and of maximum length. We can freely drive from the point
3
to the point6
without meeting a single traffic lights.Okk, got it, thanks