Editorial
Let be the right endpoint reachable with the current number of moves, and let be the farthest position reachable with one additional move from this range.
Scan positions from left to right and update . When , the computed becomes the endpoint for the next move count. If the range no longer expands, position is unreachable.
The time complexity is per test case.
Solution written by GPT5