QOJ.ac

QOJ

Limite de temps : 2.0 s Limite de mémoire : 256 MB Points totaux : 100

#12756. 飞行之乐

Statistiques

Jacob 喜欢玩他的遥控飞机。今天天气风很大,Jacob 必须仔细规划飞行路线。他有一份天气预报,记录了计划飞行期间每一秒的风速和风向。

飞机在任何方向上的空速最高可达 $v_{max}$ 单位/秒。风对飞机的影响如下:如果飞机的空速为 $(v_x, v_y)$,风速为 $(w_x, w_y)$,则飞机每秒移动 $(v_x + w_x, v_y + w_y)$。

Jacob 的燃料恰好足够飞行 $k$ 秒,他想知道飞机是否能在该时间内从起点飞到终点。如果可能,他需要知道飞行计划:即每一秒飞行后飞机的位置。

输入格式

输入文件的第一行包含四个整数 $S_x, S_y, F_x, F_y$,表示起点和终点的坐标($-10\,000 \le S_x, S_y, F_x, F_y \le 10\,000$)。

第二行包含三个整数 $n, k$ 和 $v_{max}$,分别表示风况变化的次数、Jacob 的飞行时长(秒)以及飞机的最大空速($1 \le n, k, v_{max} \le 10\,000$)。

接下来的 $n$ 行包含风况描述。第 $i$ 行包含整数 $t_i, w_{x_i}$ 和 $w_{y_i}$,表示从时间 $t_i$ 开始,风每秒吹动的向量为 $(w_{x_i}, w_{y_i})$($0 = t_1 < \dots < t_i < t_{i+1} < \dots < k$;$\sqrt{w_{x_i}^2 + w_{y_i}^2} \le v_{max}$)。

输出格式

如果 Jacob 的飞机能在 $k$ 秒内从起点飞到终点,第一行输出 “Yes”,否则输出 “No”。

如果可以到达,接下来的 $k$ 行应包含飞行计划。第 $i$ 行应包含两个浮点数 $x$ 和 $y$,表示飞行第 $i$ 秒后飞机的位置 $(P_i)$ 的坐标。

如果对于每个 $1 \le i \le k$,都能在 1 秒内从 $P_{i-1}$ 飞到某一点 $Q_i$,使得 $Q_i$ 与 $P_i$ 之间的距离不超过 $10^{-5}$(其中 $P_0 = S$),且 $P_k$ 与 $F$ 之间的距离也不超过 $10^{-5}$,则该计划是正确的。

样例

输入 1

1 1 7 4
2 3 10
0 1 2
2 2 0

输出 1

Yes
3 2.5
5 2.5
7 4

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.