benchmarks.wiki / Public workspace

Humanity's Last Code Exam / 2017_A / Airport Construction

Problem

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

platform

atcoder

question content

### Problem Statement The tropical island nation of Piconesia is famous for its beautiful beaches, lush vegetation, cocoa and coffee plantations, and wonderful weather all year round. This paradise is being considered as a future location for the World Finals of the ACM International Collegiate Programming Contest (or at the very least a vacation spot for the executive council). There is only one small problem: the island is really hard to reach. Currently, the fastest way to reach the island takes three days from the nearest airport, and uses a combination of fishing boat, oil tanker, kayak, and submarine. To make attending the ICPC World Finals slightly easier and to jump-start the island’s tourism business, Piconesia is planning to build its first airport. Since longer landing strips can accommodate larger airplanes, Piconesia has decided to build the longest possible landing strip on their island. Unfortunately, they have been unable to determine where this landing strip should be located. Maybe you can help? For this problem, we model the boundary of Piconesia as a polygon. Given this polygon, you need to compute the length of the longest landing strip (i.e., straight line segment) that can be built on the island. The landing strip must not intersect the sea, but it may touch or run along the boundary of the island. Figure A.1 shows an example corresponding to the first sample input. ### Input - The input starts with a line containing an integer n n (3 ≤ n n ≤ 200) specifying the number of vertices of the polygon. - This is followed by n n lines, each containing two integers x x and y y (|x|,|y|106|x|, |y| \leq 10^6) that give the coordinates (x,y)(x, y) of the vertices of the polygon in counter-clockwise order. - The polygon is simple, i.e., its vertices are distinct and no two edges of the polygon intersect or touch, except that consecutive edges touch at their common vertex. In addition, no two consecutive edges are collinear. ### Output - Display the length of the longest straight line segment that fits inside the polygon, with an absolute or relative error of at most 106 10^{-6} . ### Sample Input 1
Plain-text mathematical notation (without MathML)
### Problem Statement

The tropical island nation of Piconesia is famous for its beautiful beaches, lush vegetation, cocoa and coffee plantations, and wonderful weather all year round. This paradise is being considered as a future location for the World Finals of the ACM International Collegiate Programming Contest (or at the very least a vacation spot for the executive council). There is only one small problem: the island is really hard to reach.

Currently, the fastest way to reach the island takes three days from the nearest airport, and uses a combination of fishing boat, oil tanker, kayak, and submarine. To make attending the ICPC World Finals slightly easier and to jump-start the island’s tourism business, Piconesia is planning to build its first airport.

Since longer landing strips can accommodate larger airplanes, Piconesia has decided to build the longest possible landing strip on their island. Unfortunately, they have been unable to determine where this landing strip should be located. Maybe you can help?

For this problem, we model the boundary of Piconesia as a polygon. Given this polygon, you need to compute the length of the longest landing strip (i.e., straight line segment) that can be built on the island. The landing strip must not intersect the sea, but it may touch or run along the boundary of the island. Figure A.1 shows an example corresponding to the first sample input.

### Input

- The input starts with a line containing an integer n (3 ≤ n ≤ 200) specifying the number of vertices of the polygon.
- This is followed by n lines, each containing two integers x and y (|x|,|y|≤10⁶) that give the coordinates (x,y) of the vertices of the polygon in counter-clockwise order.
- The polygon is simple, i.e., its vertices are distinct and no two edges of the polygon intersect or touch, except that consecutive edges touch at their common vertex. In addition, no two consecutive edges are collinear.

### Output

- Display the length of the longest straight line segment that fits inside the polygon, with an absolute or relative error of at most 10^(−6).

### Sample Input 1
Original LaTeX notation
### Problem Statement

The tropical island nation of Piconesia is famous for its beautiful beaches, lush vegetation, cocoa and coffee plantations, and wonderful weather all year round. This paradise is being considered as a future location for the World Finals of the ACM International Collegiate Programming Contest (or at the very least a vacation spot for the executive council). There is only one small problem: the island is really hard to reach.

Currently, the fastest way to reach the island takes three days from the nearest airport, and uses a combination of fishing boat, oil tanker, kayak, and submarine. To make attending the ICPC World Finals slightly easier and to jump-start the island’s tourism business, Piconesia is planning to build its first airport.

Since longer landing strips can accommodate larger airplanes, Piconesia has decided to build the longest possible landing strip on their island. Unfortunately, they have been unable to determine where this landing strip should be located. Maybe you can help?

For this problem, we model the boundary of Piconesia as a polygon. Given this polygon, you need to compute the length of the longest landing strip (i.e., straight line segment) that can be built on the island. The landing strip must not intersect the sea, but it may touch or run along the boundary of the island. Figure A.1 shows an example corresponding to the first sample input.

### Input

- The input starts with a line containing an integer \( n \) (3 ≤ \( n \) ≤ 200) specifying the number of vertices of the polygon.
- This is followed by \( n \) lines, each containing two integers \( x \) and \( y \) (\(|x|, |y| \leq 10^6\)) that give the coordinates \((x, y)\) of the vertices of the polygon in counter-clockwise order.
- The polygon is simple, i.e., its vertices are distinct and no two edges of the polygon intersect or touch, except that consecutive edges touch at their common vertex. In addition, no two consecutive edges are collinear.

### Output

- Display the length of the longest straight line segment that fits inside the polygon, with an absolute or relative error of at most \( 10^{-6} \).

### Sample Input 1

Code

7
0 20
40 0
40 20
70 50
50 70
30 50
0 50

### Sample Output 1

Code

76.157731059

### Sample Input 2

Code

3
0 2017
-2017 -2017
2017 0

### Sample Output 2

Code

4510.149110617

question title

Airport Construction

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