CF1016E Rest In The Shades
题目描述
在第四象限有一个从 $A$ 沿线段 $AB$ 运动到 $B$ 的光源,速度为 $1$ 个单位/秒,在 $x$ 轴正半轴上有 $n$ 条互不重叠的线段,这些线段会遮挡住光线,在动点的运动过程中如图所示产生阴影,给你 $q$ 个第一象限内的点,询问每个点在阴影内的时间为多少秒。
输入格式
第$1$行三个整数,$s_y$,$a$,$b$,代表$A$点坐标为$(a,s_y)$,$B$点坐标为$(b,s_y)$
第 $2$ 行一个整数 $n$,代表线段的条数
后 $n$ 行每行 $2$ 个正整数 $l_i,r_i$ 代表一条线段的左端点和右端点
再下一行一个正整数 $q$ 代表询问的点的个数
后 $q$ 行每行两个正整数 $x_i,y_i$ 代表一个询问的点
输出格式
$q$ 行每行一个实数代表一次询问的结果,与答案绝对/相对误差在 $10^{-6}$ 内算对
说明/提示
- The 1-st point is always in the shade;
- the 2-nd point is in the shade while light source is moving from $ (3, -3) $ to $ (6, -3) $ ;
- the 3-rd point is in the shade while light source is at point $ (6, -3) $ .
- the 4-th point is in the shade while light source is moving from $ (1, -3) $ to $ (2.5, -3) $ and at point $ (6, -3) $ ;
- the 5-th point is in the shade while light source is moving from $ (1, -3) $ to $ (2.5, -3) $ and from $ (5.5, -3) $ to $ (6, -3) $ ;