切分区域的重心AI (CI翻译)
Problem Statement
题目描述
AI (CI翻译)There is a convex $N$-gon $P$ on the $xy$-plane. The vertices of $P$ are numbered $1,2,\dots,N$ counterclockwise, and the coordinates of vertex $i$ are $(x_i,y_i)$.
在 $xy$ 平面上有一个凸 $N$ 边形 $P$。$P$ 的顶点按逆时针顺序编号为 $1,2,\dots,N$,顶点 $i$ 的坐标为 $(x_i,y_i)$。AI (CI翻译)
Answer $Q$ questions.
请回答 $Q$ 个询问。AI (CI翻译)
The $j$-th question gives two distinct vertices $u_j$ and $v_j$. Here, the vertices $u_j$ and $v_j$ are not adjacent on the boundary of $P$.
第 $j$ 个询问给出两个不同的顶点 $u_j$ 和 $v_j$。其中,顶点 $u_j$ 和 $v_j$ 在 $P$ 的边界上不相邻。AI (CI翻译)
The segment connecting vertices $u_j$ and $v_j$ divides $P$ into two polygons; let $P'$ be the one lying to the right of the directed line from vertex $u_j$ to vertex $v_j$. Find the coordinates of the geometric center of $P'$ (the centroid obtained by regarding the interior of the polygon as a thin plate of uniform density).
连接顶点 $u_j$ 和 $v_j$ 的线段将 $P$ 分成两个多边形。设 $P'$ 为位于从顶点 $u_j$ 指向顶点 $v_j$ 的有向直线右侧的那个多边形。求 $P'$ 的几何中心坐标(即将多边形内部视为密度均匀的薄板时的重心)。AI (CI翻译)
Constraints
约束条件
AI (CI翻译)$4 \leq N \leq 3 \times 10^4$$1 \leq Q \leq 2 \times 10^5$$|x_i|,|y_i| \leq 5 \times 10^5$$(x_1,y_1),(x_2,y_2),\dots,(x_N,y_N)$form a convex polygon in counterclockwise order.- All interior angles of
$P$are less than$180$degrees. $1 \leq u_j,v_j \leq N$$u_j \neq v_j$- Vertices
$u_j$and$v_j$are not adjacent on the boundary of$P$. - All input values are integers.
$4 \leq N \leq 3 \times 10^4$$1 \leq Q \leq 2 \times 10^5$$|x_i|,|y_i| \leq 5 \times 10^5$$(x_1,y_1),(x_2,y_2),\dots,(x_N,y_N)$按逆时针顺序构成一个凸多边形。$P$的所有内角均小于$180$度。$1 \leq u_j,v_j \leq N$$u_j \neq v_j$- 顶点
$u_j$和$v_j$在$P$的边界上不相邻。 - 所有输入值均为整数。
Input
输入格式
AI (CI翻译)The input is given from Standard Input in the following format:
输入通过标准输入以如下格式给出:AI (CI翻译)
N Q
x_1 y_1
x_2 y_2
\vdots
x_N y_N
u_1 v_1
u_2 v_2
\vdots
u_Q v_Q
N Q
x_1 y_1
x_2 y_2
\vdots
x_N y_N
u_1 v_1
u_2 v_2
\vdots
u_Q v_QAI (CI翻译)
Output
输出格式
AI (CI翻译)Output $Q$ lines. On the $j$-th line, letting $(p_j,q_j)$ be the coordinates of the answer to the $j$-th question, output $p_j$ and $q_j$ in this order, separated by a space.
输出 $Q$ 行。在第 $j$ 行,设第 $j$ 个询问的答案坐标为 $(p_j,q_j)$,请依次输出 $p_j$ 和 $q_j$,以一个空格分隔。AI (CI翻译)
The answer is considered correct if, for each of $p_j$ and $q_j$, its absolute or relative error from the true value is at most $10^{-6}$.
对于 $p_j$ 和 $q_j$ 中的每一个值,若其与真实值的绝对误差或相对误差不超过 $10^{-6}$,则认为答案正确。AI (CI翻译)
样例
5 4
4 1
1 3
-3 2
-1 -2
2 -1
2 4
5 3
1 4
4 2
-1.000000000000000 1.000000000000000
0.864197530864198 1.209876543209877
0.198198198198198 0.828828828828829
1.391304347826087 0.434782608695652
10 10
480451 142016
404696 274257
7097 390813
-134582 195390
-167108 143104
-359470 -180367
-406293 -273476
74335 -494832
486873 -391664
493159 -292349
5 8
8 6
5 2
5 1
10 3
1 7
3 5
2 5
4 9
1 8
-167917.431926206833203 -207268.968943785114349
126221.026579795702381 -68771.715180365014040
111801.954824466955586 -124063.178438661167072
99590.935535112756283 -153792.378227918737825
321662.353363423237819 113722.100435559268610
43574.061369374611386 102411.022160871806300
-98197.666666666666667 243102.333333333333333
79984.488622522356481 269160.678085376751920
-3267.792578363696043 -210454.379232334372417
46257.363593155145794 -38546.483790939251583
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。