QOJ.ac

QOJ

実行時間制限: 1.0 s メモリ制限: 256 MB 満点: 100 ハック可能 ✓

#16761. Hanmattan

統計

Hanmattan 岛可以表示为一个 $M \times N$ 的网格:有 $M + 1$ 条南北方向的街道,以及 $N + 1$ 条东西方向的大道。任意两条相邻的街道或大道之间的距离等于 $1$。

自然地,交叉路口可以用一对数字来标识:即在该路口相交的街道和大道,坐标范围从 $(0, 0)$ 到 $(M, N)$。

一名出租车司机收到一个订单,要将乘客 $A$ 从其中一个交叉路口送到位于另一个交叉路口的火车站。出租车只能沿着街道和大道行驶。

在乘客上车时,司机得知有另一位乘客 $B$ 正在第三个交叉路口等待,并且也想去往同一个火车站。现在,出租车司机希望沿着将乘客 $A$ 送往火车站的某条最优(最短)路径行驶,但此外,他还希望在途中顺便接上乘客 $B$。给出所有这三个交叉路口的坐标,判断这是否可行。

输入格式

输入的第一行包含四个整数 $x_a, y_a, x_s, y_s$:乘客 $A$ 所在的交叉路口坐标以及火车站所在的交叉路口坐标。

第二行包含两个整数 $x_b$ 和 $y_b$:乘客 $B$ 所在的交叉路口坐标。

所有坐标均为非负整数且不超过 $10^6$。保证这三个交叉路口两两不同。

输出格式

如果可以在将乘客 $A$ 沿最优路径送往车站的途中接上乘客 $B$,则输出 "Yes",否则输出 "No"。

样例

输入样例 1

1 1 3 4
2 2

输出样例 1

Yes

输入样例 2

2013 1 2 2014
2014 2013

输出样例 2

No

输入样例 3

100 0 0 100
0 0

输出样例 3

Yes

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.