Universal Cup Judging System

Universal Cup

実行時間制限: 1.5 s メモリ制限: 2048 MB 満点: 100 ハック可能 ✓
統計

$2$ 次元平面上に $n$ 本の線分があります。各線分は $x$ 軸の非負部分から始まり、$y$ 軸の非負部分で終わります。言い換えると、始点の座標は $(x_i, 0)$($x_i \ge 0$)であり、終点の座標は $(0, y_i)$($y_i \ge 0$)です。

$q$ 個のクエリが与えられます。各クエリでは、始点が $x$ 軸上にあり、終点が平面の第 $1$ 象限または座標軸の非負部分の任意の場所にある線分が指定されます。各クエリの線分について、既存の線分のいずれかと交差するかどうかを判定してください。端点での交差も交差とみなします。

クエリは互いに独立しています。つまり、各クエリで与えられた線分が残りのクエリに保持されることはありません。

入力

入力は複数のテストケースを含みます。入力の $1$ 行目には、テストケースの個数を表す整数 $T$($1 \le T \le 10^6$)が含まれます。

各テストケースについて、最初の行には既存の線分の本数とクエリの個数を表す $2$ つの整数 $n, q$($1 \le n, q \le 10^6$)が含まれます。

続く $n$ 行のそれぞれには、$(x_i, 0)$ から始まり $(0, y_i)$ で終わる線分を表す $2$ つの整数 $x_i, y_i$($0 \le x_i, y_i \le 10^9$)が含まれます。

その後、続く $q$ 行のそれぞれには、$(a_j, 0)$ から始まり $(b_j, c_j)$ で終わるクエリの線分を表す $3$ つの整数 $a_j, b_j, c_j$($0 \le a_j, b_j, c_j \le 10^9$)が含まれます。

すべてのテストケースにおける $n$ の総和および $q$ の総和は、それぞれ $10^6$ を超えないことが保証されています。

出力

各クエリについて、クエリの線分が既存の線分の少なくとも $1$ つと(端点を含む)交差する場合は 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.