| XIII UnB Contest Mirror |
|---|
| Finished |
The cycle for the next Exatas Cup has already begun, and Cauê, the maestro of Selecic, is already thinking about new tactics to pursue the title in the next edition.
Cauê is considering organizing the team in a positional manner, where each player must operate in a restricted tactical area of the field according to their role. For example, forwards should operate near the opponent's goal, defenders in the team's defensive area, and the goalkeeper only in the area restricted to the goal. However, the idea of a role can be quite complex: within the space reserved for a role, there can be other roles contained within it!
For example, within the forwards' space, there may be a space reserved for wingers and for center-forwards. And also within the wingers' space, there can be a space for those with inverted feet and those with natural feet. Roles can be nested within others arbitrarily! However, there cannot be two roles that share space unless one is contained within the other — this would go against Cauê's tactical principles.
To illustrate his idea, Cauê used a Cartesian plane to draw the tactical regions. Each region was represented by a simple convex polygon, such that the edges of polygons from different regions do not intersect. This ensures that, between different regions, either they do not intersect or one is strictly contained (i.e., "inside") the other.
The other members of Selecic were quite confused by Cauê's drawing. A recurring question was: "If I want to start playing at point $$$(X, Y)$$$, how many roles will I have to perform in the game? That is, how many roles contain the point $$$(X, Y)$$$?". After all, the players on the team do not have the capacity to perform too many roles in the match...
Cauê is busy watching the Vasco game, and therefore asked you to take his place in answering the questions from the Selecic players! He has suffered enough with this team, so it doesn't hurt to do him this favor.
The first line of the input contains two integers: $$$N$$$ and $$$Q$$$, representing respectively the number of regions drawn by Cauê and the number of questions from the players.
The following lines contain the descriptions of the polygons of each of the $$$N$$$ regions. The description of the $$$i$$$-th polygon starts with a line containing the integer $$$k_i$$$: the number of vertices of the polygon. The next $$$k_i$$$ lines each contain two integers $$$X$$$ and $$$Y$$$, representing the Cartesian coordinates of a vertex of the polygon. The vertices are given in counterclockwise order, and there are no three consecutive collinear vertices.
Then, the next $$$Q$$$ lines each contain two integers $$$X$$$ and $$$Y$$$, representing the Cartesian coordinates of the points associated with the players' questions.
It is guaranteed that the edges of the polygons do not intersect. Additionally, it is guaranteed that the points of the questions are not vertices nor are they on the edge of any of the polygons in the input. Finally, all points in the input are distinct.
It is also guaranteed that $$$N, Q \geq 1$$$, $$$k_i \geq 3$$$, $$$-10^9 \leq X, Y \leq 10^9$$$, and that $$$(Q + \sum_{i=1}^n k_i) \leq 6 \cdot 10^5$$$.
Print $$$Q$$$ lines: on the $$$i$$$-th line, the number of regions that contain the point from the $$$i$$$-th question.
1 24-1 00 -11 00 10 01 1
1 0
3 341 43 29 82 631 011 90 842 53 36 63 63 52 41 3
3 2 1
| Name |
|---|


