#BS0000413. Hòa tan đa giác (Meltdown)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Hòa tan đa giác (Meltdown)
Meltdown
Source: Kattis
Version: Phuoc Hung OJ Extended
Problem Statement
A flat polygonal piece of material is translated vertically downwards into a liquid at a constant speed metres per minute, without rotating. The liquid surface is at and the piece initially lies entirely above it.
When exposed to the liquid, the material dissolves in its plane from all sides at speed metres per minute. The liquid occupies three-dimensional space, allowing it to enter concave recesses from outside the piece, as illustrated below.

A target point is specified by its initial coordinates strictly inside the piece and moves with it until dissolved. Find the earliest time, measured from the beginning of the descent, when the liquid reaches .
Input
The first line contains five integers : the vertex count, the two target coordinates, the descent speed, and the dissolution speed. Each of the next lines contains two integers , the initial coordinates of vertex . Vertices are listed counterclockwise.
Output
Print the earliest time in minutes, rounded to exactly four digits after the decimal point. In an exact halfway case, round upward.
Subtasks
- Subtask 1 (20 points): ; ; for ; . All input values are integers; the polygon is simple, its vertices are counterclockwise, its boundary neither crosses nor touches itself, and is strictly inside. and all edges are axis-aligned (a rectangle).
- Subtask 2 (30 points): ; ; for ; . All input values are integers; the polygon is simple, its vertices are counterclockwise, its boundary neither crosses nor touches itself, and is strictly inside. The polygon is convex (consecutive collinear vertices are allowed).
- Subtask 3 (50 points): ; ; for ; . All input values are integers; the polygon is simple, its vertices are counterclockwise, its boundary neither crosses nor touches itself, and is strictly inside.
Examples
Input
4 0 50 2 1
-1 10
1 10
1 90
-1 90
Output
25.8660
Explanation
The target lies between two vertical sides, each 1 m away. Entry on either side at height about 49.42265 m takes 24.71132 min; the remaining distance is about 1.15470 m, taking 1.15470 min. The minimum is 25.866025... min, rounded to 25.8660.
Input
4 0 2 2 1
-10 1
10 1
10 5
-10 5
Output
1.5000
Explanation
The bottom reaches the liquid after 0.5 min; the target is 1 m above it, requiring one more minute. Every other side is at least 3 m away and cannot reach the target sooner.