Editorial for Bubble Cup V8 D Tablecity
Submitting an official solution before solving the problem yourself is a bannable offence.
First notice that parity of thief's coordinate changes every time he moves.
Assume that at the beginning coordinate of thief's position is odd, and check districts and . The next day check districts and and so on until when you check districts and . What is achieved this way is that if starting parity was as assumed, thief could have never moved to district with coordinate on day , hence he couldn't have jumped over the search party and would've been caught. If he wasn't caught, his starting parity was different than we assumed, so on day we search whatever ( and are of the same parity, so we need to wait one day), and then starting on day we do the same sweep from and to and and guarantee to catch him.
Shortest possible solution is by going from and to and twice in a row, a total of days, which is correct in the same way. First sweep catches the thief if he started with even coordinate, and second sweep catches the thief if he started with odd coordinate.
Comments