Nested Convex Polygons Containment Query

Правка en3, от bao987, 2025-07-19 17:47:33

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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en6 Английский bao987 2025-07-19 18:21:22 0 (published)
en5 Английский bao987 2025-07-19 18:20:01 58 Tiny change: '\n\n4\n\n2' -> '\n\n4\n\n2\n\nproblem link: https://vjudge.net/problem/VNOJ-kingdoms' (saved to drafts)
en4 Английский bao987 2025-07-19 17:53:56 0 (published)
en3 Английский bao987 2025-07-19 17:47:33 0 (saved to drafts)
en2 Английский bao987 2025-07-19 17:29:57 2 Tiny change: 'polygon.\nInput fo' -> 'polygon.\n\nInput fo'
en1 Английский bao987 2025-07-19 17:18:06 1139 Initial revision (published)