ICPC 2017 - A. Airport Construction
State the problem in your own words. Focus on the mathematical or algorithmic core rather than repeating the full statement.
Source-first archive entry
This page is built from the copied files in competitive_programming/icpc/2017/A-airport-construction. Edit
competitive_programming/icpc/2017/A-airport-construction/solution.tex to update the written solution and
competitive_programming/icpc/2017/A-airport-construction/solution.cpp to update the implementation.
The website does not replace those files with hand-maintained HTML. It reads the copied source tree during the build and exposes the exact files below.
Problem Statement
Copied statement text kept beside the solution archive for direct reference.
Rapid City
event
sponsor
ICPC 2017
Problem A
Airport Construction
Time limit: 2 seconds
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.
Figure A.1: The island modeled as a polygon. The longest possible landing strip is shown as a thick line.
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| ≤ 106 ) 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.
Rapid City
event
sponsor
ICPC 2017
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 Sample Output 1
7 76.157731059
0 20
40 0
40 20
70 50
50 70
30 50
0 50
Sample Input 2 Sample Output 2
3 4510.149110617
0 2017
-2017 -2017
2017 0
Editorial
Rendered from the copied solution.tex file. The original TeX source remains
available below.
Key Observations
Write the structural observations that make the problem tractable.
State any useful invariant, monotonicity property, graph interpretation, or combinatorial reformulation.
If the constraints matter, explain exactly which part of the solution they enable.
Algorithm
Describe the data structures and the state maintained by the algorithm.
Explain the processing order and why it is sufficient.
Mention corner cases explicitly if they affect the implementation.
Correctness Proof
We prove that the algorithm returns the correct answer.
Lemma 1.
State the first key claim.
Proof.
Provide a concise proof.
Lemma 2.
State the next claim if needed.
Proof.
Provide a concise proof.
Theorem.
The algorithm outputs the correct answer for every valid input.
Proof.
Combine the lemmas and finish the argument.
Complexity Analysis
State the running time and memory usage in terms of the input size.
Implementation Notes
Mention any non-obvious implementation detail that is easy to get wrong.
Mention numeric limits, indexing conventions, or tie-breaking rules if relevant.
Code
Exact copied C++ implementation from solution.cpp.
#include <bits/stdc++.h>
using namespace std;
namespace {
void solve() {
// Fill in the full solution logic for the problem here.
}
} // namespace
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}
Source Files
Exact copied source-of-truth files. Edit solution.tex for the write-up and solution.cpp for the implementation.
\documentclass[11pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{enumitem}
\title{ICPC World Finals 2017\\A. Airport Construction}
\author{}
\date{}
\begin{document}
\maketitle
\section*{Problem Summary}
State the problem in your own words. Focus on the mathematical or algorithmic core rather than repeating the full statement.
\section*{Key Observations}
\begin{itemize}[leftmargin=*]
\item Write the structural observations that make the problem tractable.
\item State any useful invariant, monotonicity property, graph interpretation, or combinatorial reformulation.
\item If the constraints matter, explain exactly which part of the solution they enable.
\end{itemize}
\section*{Algorithm}
\begin{enumerate}[leftmargin=*]
\item Describe the data structures and the state maintained by the algorithm.
\item Explain the processing order and why it is sufficient.
\item Mention corner cases explicitly if they affect the implementation.
\end{enumerate}
\section*{Correctness Proof}
We prove that the algorithm returns the correct answer.
\paragraph{Lemma 1.}
State the first key claim.
\paragraph{Proof.}
Provide a concise proof.
\paragraph{Lemma 2.}
State the next claim if needed.
\paragraph{Proof.}
Provide a concise proof.
\paragraph{Theorem.}
The algorithm outputs the correct answer for every valid input.
\paragraph{Proof.}
Combine the lemmas and finish the argument.
\section*{Complexity Analysis}
State the running time and memory usage in terms of the input size.
\section*{Implementation Notes}
\begin{itemize}[leftmargin=*]
\item Mention any non-obvious implementation detail that is easy to get wrong.
\item Mention numeric limits, indexing conventions, or tie-breaking rules if relevant.
\end{itemize}
\end{document}
#include <bits/stdc++.h>
using namespace std;
namespace {
void solve() {
// Fill in the full solution logic for the problem here.
}
} // namespace
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}