No.1932 動く点 P / Moving Point P
Problem Statement
There is a point ${\rm P}_j$ at $(x_j, y_j)$ on the coordinate plane. ($1 \le j \le Q$)
In the $i(1 \le i \le N)$-th operation, null-kun rotates a point counterclockwise by $r_i^\circ$ around $(p_i, q_i)$. (Note that the angle is given in degrees.)
For each $j$, find the final coordinates of ${\rm P}_j$ when only the operations from the $s_j$-th through the $t_j$-th are applied to the point ${\rm P}_j$ in order.
Constraints
- $1 \le N, Q \le 10^5$
- $-1000 \le p_i, q_i, x_j, y_j \le 1000$
- $-360 \le r_i \le 360$
- $1 \le s_j \le t_j \le N$ (corrected at 22:07)
- $N, Q, s_j, t_j$ are integers.
- $p_i, q_i, r_i, x_j, y_j$ are given with up to $6$ digits after the decimal point.
Input
$N$ $p_1\ q_1\ r_1$ $p_2\ q_2\ r_2$ $\dots$ $p_N\ q_N\ r_N$ $Q$ $s_1\ t_1\ x_1\ y_1$ $s_2\ t_2\ x_2\ y_2$ $\dots$ $s_Q\ t_Q\ x_Q\ y_Q$
Output
On the $j$-th line, print the final coordinates of ${\rm P}_j$, separated by a space on one line, when only the operations from the $s_j$-th through the $t_j$-th are applied to the point ${\rm P}_j$ in order.
Your answer is considered correct if the smaller of the absolute error and the relative error from the expected solution is $10^{-3}$. (corrected at 23:04)
Sample
Sample 1
Input
5 0.000000 0.000000 90.000000 1.000000 1.000000 180.000000 133.000000 333.000000 0.000000 367.092893 80.084048 -75.124327 842.043304 429.624441 0.066603 5 1 1 0.000000 0.000000 2 2 0.000000 0.000000 1 2 0.000000 0.000000 1 4 123.000000 456.900000 2 4 0.127890 0.123490
Output
0.000000 0.000000 2.000000 2.000000 2.000000 2.000000 196.317090 -60.268951 197.746090 412.986886
For the $1$st output, rotating $(0,0)$ by $90^\circ$ around $(0,0)$ gives the coordinates $(0,0)$.
For the $2$nd output, rotating $(0,0)$ by $180^\circ$ around $(1,1)$ gives the coordinates $(2,2)$.
For the $3$rd output, applying the above two operations in order gives the coordinates $(2,2)$.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
null
Rho