Editorial for CPC '19 Contest 1 P1 - Distance
Submitting an official solution before solving the problem yourself is a bannable offence.
For the first subtask, you can just brute force all possible ways you can visit all the houses and output any that matches the constraints of the problem.
The trick here is to start from , then go to , then back to , then go to , then back to , etc. If you look at the sequence here, you'll notice the absolute difference between adjacent values is constantly decreasing:
Absolute Value of Differences: