Kattis

# 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:

1. Exploration

2. Vacuuming

3. 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 $P$ inside it, determine the shortest route that touches each wall and then returns to $P$. Touching a corner counts as touching both incident walls.

## Input

Each test case starts with a line containing the number of vertices $N$ of the polygon ($3 \leq N \leq 100$) and the integer coordinates $P_ x$ and $P_ y$ of the robot’s starting point $(-10\, 000~ \leq ~ P_ x,P_ y~ \leq ~ 10\, 000)$. This is followed by $N$ lines, each containing two integers $x$, $y$ ($-10\, 000 \leq x,y \leq 10\, 000$) defining a vertex of the polygon. Vertices are given in counterclockwise order, all interior angles are less than 180 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, with exactly two decimal places.

Sample Input 1 Sample Output 1
4 0 0
-1 -1
1 -1
1 1
-1 1
3 10 1
0 0
30 0
0 20
Case 1: 5.66
Case 2: 36.73
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.2657201886177063, "perplexity": 810.0367028043134}, "config": {"markdown_headings": true, "markdown_code": false, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-39/segments/1568514578201.99/warc/CC-MAIN-20190923193125-20190923215125-00375.warc.gz"}