A10518 | Chris and Road
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
And while Mishka is enjoying her trip...
Chris is a little brown bear. No one knows, where and when he met Mishka, but for a long time they are together (excluding her current trip). However, best friends are important too. John is Chris' best friend.
Once walking with his friend, John gave Chris the following problem:
At the infinite horizontal road of width $w$ , bounded by lines $y=0$ and $y=w$ , there is a bus moving, presented as a convex polygon of $n$ vertices. The bus moves continuously with a constant speed of $v$ in a straight $Ox$ line in direction of decreasing $x$ coordinates, thus in time only $x$ coordinates of its points are changing. Formally, after time $t$ each of $x$ coordinates of its points will be decreased by $vt$ .
There is a pedestrian in the point $(0,0)$ , who can move only by a vertical pedestrian crossing, presented as a segment connecting points $(0,0)$ and $(0,w)$ with any speed not exceeding $u$ . Thus the pedestrian can move only in a straight line $Oy$ in any direction with any speed not exceeding $u$ and not leaving the road borders. The pedestrian can instantly change his speed, thus, for example, he can stop instantly.
Please look at the sample note picture for better understanding.
We consider the pedestrian is hit by the bus, if at any moment the point he is located in lies strictly inside the bus polygon (this means that if the point lies on the polygon vertex or on its edge, the pedestrian is not hit by the bus).
You are given the bus position at the moment $0$ . Please help Chris determine minimum amount of time the pedestrian needs to cross the road and reach the point $(0,w)$ and not to be hit by the bus.
Chris is a little brown bear. No one knows, where and when he met Mishka, but for a long time they are together (excluding her current trip). However, best friends are important too. John is Chris' best friend.
Once walking with his friend, John gave Chris the following problem:
At the infinite horizontal road of width $w$ , bounded by lines $y=0$ and $y=w$ , there is a bus moving, presented as a convex polygon of $n$ vertices. The bus moves continuously with a constant speed of $v$ in a straight $Ox$ line in direction of decreasing $x$ coordinates, thus in time only $x$ coordinates of its points are changing. Formally, after time $t$ each of $x$ coordinates of its points will be decreased by $vt$ .
There is a pedestrian in the point $(0,0)$ , who can move only by a vertical pedestrian crossing, presented as a segment connecting points $(0,0)$ and $(0,w)$ with any speed not exceeding $u$ . Thus the pedestrian can move only in a straight line $Oy$ in any direction with any speed not exceeding $u$ and not leaving the road borders. The pedestrian can instantly change his speed, thus, for example, he can stop instantly.
Please look at the sample note picture for better understanding.
We consider the pedestrian is hit by the bus, if at any moment the point he is located in lies strictly inside the bus polygon (this means that if the point lies on the polygon vertex or on its edge, the pedestrian is not hit by the bus).
You are given the bus position at the moment $0$ . Please help Chris determine minimum amount of time the pedestrian needs to cross the road and reach the point $(0,w)$ and not to be hit by the bus.
输入格式
The first line of the input contains four integers $n$ , $w$ , $v$ , $u$ ( $3<=n<=10000$ , $1<=w<=10^{9}$ , $1<=v,u<=1000$ ) — the number of the bus polygon vertices, road width, bus speed and pedestrian speed respectively.
The next $n$ lines describes polygon vertices in counter-clockwise order. $i$ -th of them contains pair of integers $x_{i}$ and $y_{i}$ ( $-10^{9}<=x_{i}<=10^{9}$ , $0<=y_{i}<=w$ ) — coordinates of $i$ -th polygon point. It is guaranteed that the polygon is non-degenerate.
The next $n$ lines describes polygon vertices in counter-clockwise order. $i$ -th of them contains pair of integers $x_{i}$ and $y_{i}$ ( $-10^{9}<=x_{i}<=10^{9}$ , $0<=y_{i}<=w$ ) — coordinates of $i$ -th polygon point. It is guaranteed that the polygon is non-degenerate.
输出格式
Print the single real $t$ — the time the pedestrian needs to croos the road and not to be hit by the bus. The answer is considered correct if its relative or absolute error doesn't exceed $10^{-6}$ .
输入输出样例
输入 #1
5 5 1 2 1 2 3 1 4 3 3 4 1 4
输出 #1
5.0000000000
Following image describes initial position in the first sample case:


C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted