Editorial for Yet Another Contest 3 P5 - No More Thieves
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Subtask 1
We can conjecture that for any random set of robots, there is a decent probability that a valid solution exists. For a given set, we can find a solution (or determine that there is no solution) by brute forcing through all ways to turn robots on and off. Whilst we have not found a solution, we can repeat this process for another set of robots.
Time complexity:
Subtask 2
Note that there are at most different horizontal lines that the RoboThieves could be hiding on. By the pigeonhole principle, there exists a horizontal line containing at least robots. Thus, we can always choose robots to leave enabled which exist on the same horizontal line.
Let's generate a list of the enabled robots, sorted by their -coordinate. Note that for each robot, in each network, the set of robots that it is connected to form a contiguous range in this list. Therefore, it suffices to turn every third robot in this list on, and turn the remaining robots off.
Time complexity: or
Subtask 3
Our construction for subtask 2 can be generalised to sets of robots other than straight lines. If we sort our set of robots by their -coordinate, then our construction will work as long as the sequence of -coordinates in this sorted list is non-increasing or non-decreasing. Let us call such a set a good set.
As it turns out, if all robots lie on their convex hull, then we are guaranteed that exists a good set with at least robots, well more than enough. The proof of this is simple and is left as an exercise to the reader. We can obtain this good set by any method, such as repeatedly randomly picking adjacent robots on the convex hull.
Time complexity:
Subtask 4
Actually, a good set always exists. Let's sort all robots by their -coordinate, and consider the sequence formed by their -coordinates. Generalising the Erdős–Szekeres theorem for repeated values, we see that there exists a non-increasing or non-decreasing subsequence with at least robots. We can then perform the same construction on this good set as before.
Time complexity:
Comments