Universal Cup Judging System

Universal Cup

Süre Sınırı: 1.5 s Bellek Sınırı: 2048 MB Toplam puan: 100 Hack'lenebilir ✓
İstatistikler

在二維平面上有 $n$ 條線段。每條線段都從 $x$ 軸的非負部分出發,並在 $y$ 軸的非負部分結束。換句話說,其起點座標為 $(x_i, 0)$ 且 $x_i \ge 0$,其終點座標為 $(0, y_i)$ 且 $y_i \ge 0$。

給定 $q$ 次詢問。在每次詢問中,會指定一條線段,其起點位於 $x$ 軸上,而終點可以位於平面上第一象限或座標軸非負部分的任意位置。對於每條詢問線段,請判斷它是否與任何現有的線段相交。在端點處的交點也算作相交。

各次詢問之間彼此獨立;也就是說,每次詢問所給出的線段不會保留到後續的詢問中。

輸入格式

輸入包含多組測試資料。輸入的第一行包含一個整數 $T$($1 \le T \le 10^6$),表示測試資料的組數。

對於每組測試資料,第一行包含兩個整數 $n, q$($1 \le n, q \le 10^6$),分別表示現有線段的數量以及詢問的數量。

接下來的 $n$ 行,每行包含兩個整數 $x_i, y_i$($0 \le x_i, y_i \le 10^9$),描述一條起點為 $(x_i, 0)$、終點為 $(0, y_i)$ 的線段。

接著,隨後的 $q$ 行,每行包含三個整數 $a_j, b_j, c_j$($0 \le a_j, b_j, c_j \le 10^9$),描述一條起點為 $(a_j, 0)$、終點為 $(b_j, c_j)$ 的詢問線段。

保證所有測試資料中 $n$ 的總和與 $q$ 的總和分別皆不超過 $10^6$。

輸出格式

對於每次詢問,若詢問線段與至少一條現有線段相交(包含端點處相交),則輸出 YES,否則輸出 NO。

範例

1
3 5
6 6
2 6
6 2
10 4 4
10 3 3
0 1 1
0 2 2
5 2 1
NO
YES
NO
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.