Hello,
I am trying to solve https://cses.fi/problemset/task/1163, but got some problem to understand it. It states that "There is a street of length x whose positions are numbered 0,1,…,n. " That should be "0, 1,..., x", not n, isn't it?
Then the example:
Input:
8 3
3 6 2
Output:
5 3 3
I think output should be 5, 3, 2, not 5, 3, 3. Since obviously the longest segment without a traffic light is 2, not 3.
0 1 2 3 4 5 6 7 8
x x x
Can somebody explain? A lot of people solved that problem, I think I am missing something. Thanks.