#P10078. Infinite Bacterial Territory

    ID: 12060 Type: Default 1000ms 256MiB

Infinite Bacterial Territory

Infinite Bacterial Territory

On an infinite 2D Cartesian plane, there are n distinct species of bacteria, each located at a unique coordinate. As time increases, these bacteria proliferate by expanding their territory in the shape of a square at a constant speed. Formally, for any time \(t\) and any point \(p\) in the plane, assume that there is a bacterium of type \(i\) at \(p\). Then:

  • If every square centered at \(p\) contains at least one bacterium of a different type, the bacterium at \(p\) does not expand (this is known as "contact inhibition").
  • If there exists a square centered at \(p\) that does not contain any bacterium of a different type, the bacterium expands its territory.

The newly expanded bacteria have the same expansion properties. For example:

  • If initially there is a single bacterium at \((0,0)\), after one unit of time it will occupy the square with vertices \((1,1)\), \((1,-1)\), \((-1,-1)\), and \((-1,1)\).
  • If there are two bacteria at \((0,0)\) and \((1,0)\) initially, the point \((0.5,0)\) becomes the division boundary, with the bacterium at \((0,0)\) eventually occupying the entire left half-plane and the bacterium at \((1,0)\) the entire right half-plane.

Your task is to determine, for each queried bacterium, whether its territory will eventually expand to an infinite area. It can be shown that a bacterium’s territory is infinite if and only if its initial position lies on the boundary of the convex hull of all bacteria positions (i.e., its Voronoi cell is unbounded).

inputFormat

The first line contains an integer \(n\) \((1 \le n \le 10^5)\), the number of bacteria.

The next \(n\) lines each contain two integers \(x\) and \(y\) \((|x|, |y| \le 10^9)\) representing the coordinates of each bacterium.

The following line contains an integer \(q\) \((1 \le q \le n)\), the number of queries.

Each of the next \(q\) lines contains a single integer \(i\) (1-indexed) indicating the queried bacterium type.

outputFormat

For each query, output Yes if the territory of the \(i\)-th bacterium is infinite, or No otherwise. Each answer should be printed on a separate line.

sample

1
0 0
1
1
Yes