#abc211f. F - Rectilinear Polygons
F - Rectilinear Polygons
Score : points
问题描述
我们有 个在 平面上的多边形。
这些多边形的所有边都与 轴或 轴平行,并且每个内角为 或 度。所有这些多边形都是简单的。
第 个多边形有 个顶点,其中第 个顶点坐标为 。
该多边形的边是由第 个顶点和第 个顶点连接而成的线段。(假设 -th 顶点是第 个顶点。)
一个多边形是简单的,当...
对于它的任何两条不相邻的边,它们之间都不会相交(交叉或接触)。
您将获得 个查询。对于每个 ,第 个查询如下所示。
- 在这 个多边形中,有多少个多边形包含点 在其内部?
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
We have polygons on the -plane.
Every side of these polygons is parallel to the - or -axis, and every interior angle is or degrees. All of these polygons are simple.
The -th polygon has corners, the -th of which is .
The sides of this polygon are segments connecting the -th and -th corners. (Assume that -th corner is the -st corner.)
A polygon is simple when...
for any two of its sides that are not adjacent, they do not intersect (cross or touch) each other.
You are given queries. For each , the -th query is as follows.
- Among the polygons, how many have the point inside them?
Constraints
- Each is even.
- if .
- for .
- for . (Assume .)
- The given polygons are simple.
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines.
The -th line should contain the answer to the -th query.
Sample Input 1
3
4
1 2 1 4 3 4 3 2
4
2 5 2 3 5 3 5 5
4
5 6 5 5 3 5 3 6
3
1 4
2 3
4 5
Sample Output 1
0
2
1
Note that different polygons may cross or touch each other.
Sample Input 2
2
4
12 3 12 5 0 5 0 3
12
1 1 1 9 10 9 10 0 4 0 4 6 6 6 6 2 8 2 8 7 2 7 2 1
4
2 6
4 4
6 3
1 8
Sample Output 2
0
2
1
1
Although the polygons are simple, they may not be convex.
update @ 2024/3/10 09:26:31