#P5525. [Ynoi2012] WC2016 充满了失望

[Ynoi2012] WC2016 充满了失望

Problem Description

In the 2D Cartesian coordinate system,

You are given nn points. These nn points are reachable. If points A,BA, B are reachable, then all points on the segment ABAB are also reachable.

You are given mm circles. Determine which circles satisfy that every point inside the circle is reachable.

Input Format

The first line contains an integer TT, which indicates the number of test cases.

Then there are TT test cases. For each test case:

The first line contains an integer nn.

The next nn lines each contain two integers xi,yix_i, y_i, representing a point.

The next line contains an integer mm.

The next mm lines each contain three integers Xi,Yi,RiX_i, Y_i, R_i, representing a circle.

Output Format

For each test case, output one line: a 01 string of length mm, representing the answers (0 means there exists an unreachable point inside the circle, 1 means all points inside the circle are reachable).

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
100000000110100

Hint

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

Sample explanation:

The red points are the points given in the sample. The orange circles indicate queries with answer 1, and the blue circles indicate queries with answer 0.

Constraints: 1n,m5×1051\leq n,m\leq 5\times 10^5, 1Ri1061\leq R_i\leq 10^6, 106xi,yi,Xi,Yi106-10^6\leq x_i,y_i,X_i,Y_i\leq 10^6, n5×105\sum n\leq 5\times 10^5, m5×105\sum m\leq 5\times 10^5.

It is guaranteed that when RiR_i changes by no more than 11, the answer does not change.

Translated by ChatGPT 5