QOJ.ac

QOJ

Time Limit: 1.0 s Memory Limit: 2048 MB Total points: 100

#15922. 寻找宝藏

Statistics

为了庆祝 Timmy 的生日,他的父母为他举办了一个海盗主题的派对!院子里埋藏着一份宝藏,现在轮到 Timmy 和他的海盗伙伴们去寻找它了。请通过告知哪些海盗能够看到宝藏埋藏的位置,来帮助他们找到宝藏。

为了让游戏更有趣,院子里放置了一些墙壁来阻挡视线。每个海盗都有一个视野范围,决定了他们能看到什么。每个海盗只能看到一定的距离,并且只能在他们所朝方向的一个半圆区域内看到(见下图)。如果另一个海盗或墙壁的某一部分直接位于被观察点与观察的海盗之间的连线上,则该点在海盗的视野中是不可见的。每个海盗都是一个单点,每面墙都是一条无限薄的线段。

哪些海盗能看到宝藏埋藏的位置?

图 1:左图对应样例输入 1,其中最右边的海盗是唯一能看到埋藏宝藏位置的人。右图对应样例输入 2,其中中间的海盗是唯一能看到埋藏宝藏位置的人。

输入格式

输入的第一行包含两个整数 $W$ ($0 \le W \le 1\,000$) 和 $P$ ($1 \le P \le 1\,000$),分别表示墙壁的数量和海盗的数量。

第二行包含宝藏的坐标。

接下来的 $W$ 行描述墙壁。这些行中的每一行都包含两个坐标 $(x, y)$ 和 $(x', y')$,表示该墙壁的两个(不同的)端点。

接下来的 $P$ 行描述海盗。其中第 $i$ 行包含两个(不同的)坐标 $(x_i, y_i)$ 和 $(x'_i, y'_i)$,其中 $(x_i, y_i)$ 是第 $i$ 个海盗的位置,而 $(x'_i, y'_i)$ 是该海盗在其注视方向上能看到的最远点。也就是说,该海盗的半圆视野半径为 $(x_i, y_i)$ 与 $(x'_i, y'_i)$ 之间的距离。

所有坐标均为整数对 $(x, y)$,满足 $|x|, |y| \le 10^9$。任意两个海盗不会处于相同的坐标位置,宝藏不会与任何海盗共享坐标位置,且任何墙壁的任何部分都不会接触到海盗或宝藏。请注意,墙壁之间可以以任何方式重叠。

输出格式

输出 $P$ 行,每个海盗占一行。如果第 $i$ 个海盗能看到宝藏埋藏的位置,则第 $i$ 行应显示 visible,否则显示 not visible

样例

输入样例 1

2 3
2 3
1 2 2 0
0 0 3 1
0 1 3 4
5 0 5 5
2 6 2 5

输出样例 1

not visible
visible
not visible

输入样例 2

0 3
0 0
1 0 1 1
3 0 -4 0
-2 0 -5 0

输出样例 2

visible
not visible
not visible

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.