| 2026 USP Try-outs |
|---|
| Закончено |
GePeTo has assumed control of practically all machines on the planet. During a resistance mission, your team was cornered by an army of robots and the only option to escape is to use an old combat spaceship.
Viewed from above, the spaceship is shaped like a convex polygon. The robots are represented by points in the plane and are all initially outside the spaceship.
The navigation systems have been damaged: before departing, it is possible to choose only one direction, and then the spaceship will follow this direction indefinitely, without making turns or rotations.
A robot is destroyed if the spaceship passes over its position at any point during its movement. Positions on the boundary of the spaceship are also considered hit.
Determine the maximum number of robots that can be destroyed by choosing the spaceship's direction of movement optimally.
The first line contains a single integer $$$N$$$ ($$$3 \leq N \leq 2 \cdot 10^5$$$), the number of vertices of the polygon representing the spaceship.
Each of the next $$$N$$$ lines contains two integers $$$x_u$$$ and $$$y_u$$$ ($$$-2 \cdot 10^9 \leq x_u, y_u \leq 2 \cdot 10^9$$$), representing the coordinates of the $$$u$$$-th vertex of the spaceship. The vertices are given in counter-clockwise order and form a convex polygon.
The next line contains a single integer $$$M$$$ ($$$1 \leq M \leq 2 \cdot 10^5$$$), the number of robots.
Each of the next $$$M$$$ lines contains two integers $$$x_v$$$ and $$$y_v$$$ ($$$-2 \cdot 10^9 \leq x_v, y_v \leq 2 \cdot 10^9$$$), representing the position of the $$$v$$$-th robot.
It is guaranteed that all robots are initially outside the spaceship's polygon.
Print a single integer: the maximum number of robots that can be destroyed by choosing a direction of movement.
40 05 05 50 5615 1520 1520 1220 10-15 00 20
4
The spaceship can choose any non-zero direction in the plane.
Throughout the movement, its shape and orientation remain unchanged: all of its points move by the same distance and in the same direction.
A robot is considered destroyed if, at some instant, its position is inside or on the boundary of the polygon occupied by the spaceship.
| Название |
|---|


