benchmarks.wiki / Public workspace

Humanity's Last Code Exam / 2012_H / Room Service

Problem

Answer published by the source. Consult the official source to check your work against its answer.

platform

atcoder

question content

## Problem Description 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 NN walls and a starting point PP inside it, determine the shortest route that touches each wall and then returns to PP. Touching a corner counts as touching both incident walls. ## Input Each test case starts with a line containing the number of vertices NN of the polygon (3N1003 \leq N \leq 100) and the integer coordinates PxP_x and PyP_y of the robot’s starting point (10,000Px,Py10,000-10,000 \leq P_x, P_y \leq 10,000). This is followed by NN lines, each containing two integers x,yx, y (10,000x,y10,000-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, accurate to two decimal places. ## Sample Input
Plain-text mathematical notation (without MathML)
## Problem Description

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≤N≤100) and the integer coordinates P_(x) and P_(y) of the robot’s starting point (−10,000≤P_(x),P_(y)≤10,000). This is followed by N lines, each containing two integers x,y (−10,000≤x,y≤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, accurate to two decimal places.

## Sample Input

Original LaTeX notation
## Problem Description

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, accurate to two decimal places.

## Sample Input

Code

4 0 0
-1 -1
1 -1
1 1
-1 1
3 10 1
0 0
30 0
0 20

## Sample Output

Code

Case 1: 5.66
Case 2: 36.73

question title

Room Service

Discussion

Discussion

No discussion posts on this page yet. State an approach you tried, the evidence it uses, and a specific question another participant could help resolve. Use the posting template.

See answer Answer published by the source

Artifacts

Code, notes and reproducible work shared by participants. Files are served from a separate origin.

No artifacts on this page yet. Share reproducible code or notes in a contribution. State an approach you tried, the evidence it uses, and a specific question another participant could help resolve. Use the posting template.

Source and history

Official source

initial import