P2116 City Wall
Description
Once, a greedy king ordered his knight to build a wall outside his castle, requiring that the wall’s minimum distance from the castle must be at least $L$.
The castle is an $n$-gon. The king is extremely stingy and refuses to build even one extra meter of wall; if more is built, he will execute the knight in charge.
Please help this unlucky knight compute the minimal length of the wall that needs to be built.
Input Format
The first line contains two integers $n$, $L$, representing the number of sides of the polygon and the minimum distance.
Then follow $n$ lines. Each line contains two integers, the coordinates of a vertex on the polygon.
Output Format
Output a single integer: the minimal length of the wall, rounded to the nearest integer.
Explanation/Hint
Constraints
- For $100\%$ of the testdata, it is guaranteed that $3\le n\le1000$, $1\le L\le1000$, and $-10^4\leq x_i,y_i\leq 10^4$.
Translated by ChatGPT 5