Long live the Queen!
After a heavy bombardment by the forces of Queen Alice, the Art Academy has started to collapse. Since
, the faithful leader of the Art Academy, was so fanatical in his obsession for art, pieces have been hung everywhere; including on the ceiling. has already managed to remove all his pieces on the walls, so he turns his salvation efforts to the sky, and prepares to catch the pieces as they fall. Fortunately for him, he is not alone. His loyal aide has come back to help him, and together, they will save the art!The Academy will be represented on a 2D plane where
For example, if there is a single painting that falls,
Input Specification
The first line will contain the integer
The next line will have the integers
The following
Constraints
For all subtasks:
Subtask 1 [10%]
Subtask 2 [20%]
Subtask 3 [70%]
No additional constraints.
Output Specification
Save the Academy! Save the artwork! Output the minimum total distance
and his aide will have to travel in order to catch all the artwork.Sample Input 1
3
1 1 4 4
3 3
1 0
5 2
Sample Output 1
6
Comments
I'm very confused. Why is my solution clearing the last subset but not the other two? Shouldn't the last one be harder?