QOJ.ac

QOJ

حد الوقت: 15.0 s حد الذاكرة: 1024 MB مجموع النقاط: 100 قابلة للهجوم ✓

#10712. 空三角形

الإحصائيات

给定平面上的 $n$ 个点。对于某些由其中三个点构成的三角形,判断它们是否为空(即三角形内部不包含其他给定的点)。

输入格式

第一行包含测试用例的数量 $Z$ ($1 \le Z \le 400$)。接下来是各测试用例的描述。

每个测试用例的第一行包含两个整数:点数 $n$ ($3 \le n \le 5\,000$) 和查询次数 $q$ ($1 \le q \le 4\,000\,000$)。

接下来的 $n$ 行包含点的坐标,每行两个整数 $x_i, y_i$ ($-10^9 \le x_i, y_i \le 10^9$)。所有点互不相同,且任意三点不共线。

最后 $q$ 行描述查询,每行包含三个不同的数字 $a_j, b_j, c_j$ ($1 \le a_j, b_j, c_j \le n$),表示第 $j$ 个三角形的三个顶点。

所有测试用例的点数总和不超过 $5\,000$。所有测试用例的查询总数不超过 $4\,000\,000$。

输出格式

对于每个查询,如果三角形为空,则输出 “YES”,否则输出 “NO”。

样例

样例输入 1

1
9 4
0 0
4 -1
8 0
9 4
8 8
4 9
0 8
-1 4
3 1
1 3 5
3 5 7
2 4 6
2 6 8

样例输出 1

NO
YES
YES
NO

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.