Hello everyone, today I’d like to ask a question related to computational geometry. I’d really appreciate your help. Thank you very, very much!
Problem summary:
You are given N convex polygons that are strictly nested — meaning some polygons are completely contained within others, forming a tree-like structure (polygon 1 is the outermost "root"). The polygons do not overlap, do not share edges, and each polygon either contains or is disjoint from others.
Each query gives a point (x, y). Your task is to find the polygon with the smallest area that contains this point.
Note: No point lies on the boundary of any polygon.
Input format:
The first line contains two integers: N and Q.
The next N lines describe the polygons. Each line starts with an integer k followed by 2k integers representing the k vertices in clockwise order: k x1 y1 x2 y2 ... xk yk
The last Q lines each contain a query point: x y
Input:
5 3
4 0 1 1 7 6 8 7 0
3 2 4 5 6 6 1
4 3 7 4 6 3 5 2 6
5 1 3 2 3 3 2 3 1 1 2
4 4 4 5 4 5 3 4 3
5 7
2 2
5 5
Output:
1
4
2




