#P15786. [JAG 2025 Summer Camp #3] Copy, Reflect, and Paste

[JAG 2025 Summer Camp #3] Copy, Reflect, and Paste

题目描述

You are given a polygon PP with NN vertices, which is not necessarily convex. Initially, let Q=PQ = P. You can perform the following operation on QQ any number of times:

  • Choose a line segment of positive length lying on the boundary of QQ, and let QQ' be the figure obtained by reflecting QQ across the line containing this segment.
  • If the interiors of QQ and QQ' intersect, the process ends immediately.
  • Otherwise, update QQ to the union of QQ and QQ'.

Determine whether the operation can be repeated indefinitely. In other words, determine whether it is possible to perform the operation at least MM times for every positive integer MM.

:::align{center} :::

输入格式

The input consists of multiple test cases.

The first line contains an integer TT (1T1001 \leq T \leq 100), representing the number of test cases.

TT test cases follow. Each test case is given in the following format.

$$\begin{aligned} & N \\ & x_{1} \ y_{1} \\ & \vdots \\ & x_{N} \ y_{N} \end{aligned}$$

For each test case, the first line contains an integer NN (3N100003 \leq N \leq 10\,000), representing the number of vertices of the polygon.

Each of the following NN lines contains two integers xix_i and yiy_i, representing that the ii-th vertex of polygon PP has coordinates (xi,yi)(x_i, y_i). These points satisfy the following conditions:

  • 109xi,yi109-10^{9} \leq x_{i}, y_{i} \leq 10^{9}
  • The vertices of polygon PP are given in counterclockwise order.
  • PP is a simple polygon; in particular, no interior angle equals 180180^{\circ}.

输出格式

Output TT lines. For each test case, output "Yes" if it is possible to perform the operation infinitely many times, and "No" otherwise.

2
4
0 0
1 0
1 1
0 1
6
11 6
19 10
9 10
5 18
5 3
15 -2
Yes
No