QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 512 MB مجموع النقاط: 100

#7473. WC2016 Full of Disappointment

الإحصائيات

In a Cartesian coordinate system, we are given $n$ points. These $n$ points are considered reachable. If points $A$ and $B$ are reachable, then all points on the line segment $AB$ are also reachable.

Given $m$ circles, determine which circles satisfy the condition that every point inside the circle is reachable.

Input

The first line contains an integer $T$, representing the number of test cases.

For each test case:

The first line contains an integer $n$.

The next $n$ lines each contain two integers $x_i, y_i$, representing the coordinates of the points.

The next line contains an integer $m$.

The next $m$ lines each contain three integers $X_i, Y_i, R_i$, representing the circles.

Output

For each test case, output a single line containing a binary string of length $m$. A 0 indicates that there exists at least one unreachable point inside the circle, and a 1 indicates that all points inside the circle are reachable.

Examples

Input 1

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

Output 1

100000000110100

Note

Idea: ccz181078, Solution: ccz181078, Code: ccz181078, Data: ccz181078

Example explanation:

The red points are the given points, the orange circles represent queries with an answer of 1, and the blue circles represent queries with an answer of 0.

$1\leq n,m\leq 5\times 10^5$, $1\leq R_i\leq 10^6$, $-10^6\leq x_i,y_i,X_i,Y_i\leq 10^6$, $\sum n\leq 5\times 10^5$, $\sum m\leq 5\times 10^5$.

It is guaranteed that the answer does not change if $R_i$ is changed by at most $1$.

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.