Room Service
You are working for a company designing cute, funny robot vacuum cleaners. At a high level, the robots’ behavior is divided into three modes:
Exploration
Vacuuming
Rampant Killing
Unfortunately, while consumer testing shows that the last two modes are working perfectly, the exploration mode still has bugs. You’ve been put in charge of debugging.
At the beginning of the exploration mode, the robot is placed into a convex polygonal room. It has sensors that should tell it where all the walls are. Your job is to write a program that verifies that these readings are correct. To do this, the robot needs to physically touch every wall in the room.
Your problem is this: given the shape of a convex polygonal room with N walls and a starting point inside it, determine the shortest route that touches each wall and then returns to . Touching a corner counts as touching both incident walls.
Input
Each test case starts with a line containing the number of vertices of the polygon and the integer coordinates and of the robot’s starting point . This is followed by lines, each containing two integers , defining a vertex of the polygon. Vertices are given in counterclockwise order, all interior angles are less than degrees, the polygon does not self-intersect, and the robot’s starting point is strictly inside the polygon.
Output
For each test case, display the case number and the length of the desired route, accurate to two decimal places.