P16054 [CSPro 31] Coordinate Transformation (Part 1).
Background
Luogu’s testdata is only for community communication and is not official testdata. Official judging link: .
Description
For a point $(x, y)$ on the Cartesian plane, Little P defines a sequence $T = (t_1, t_2, \cdots, t_n)$ consisting of $n$ operations. Each operation $t_i$ ($1 \le i \le n$) has two parameters $dx_i$ and $dy_i$, meaning translating the point $(x, y)$ to $(x + dx_i, y + dy_i)$.
Now given $m$ initial points, compute the final coordinates after applying the $n$ operations in $T$ in order to each point $(x_j, y_j)$ ($1 \le j \le m$).
Input Format
Read input from standard input.
There are $n + m + 1$ lines in total.
The first line contains two positive integers $n$ and $m$ separated by spaces, representing the number of operations and the number of initial points.
The next $n$ lines describe the $n$ operations in order. Line $i$ ($1 \le i \le n$) contains two integers $dx_i$ and $dy_i$ separated by spaces.
The next $m$ lines describe the $m$ points in order. Line $j$ ($1 \le j \le m$) contains two integers $x_j$ and $y_j$ separated by spaces.
Output Format
Output to standard output.
Output $m$ lines. Line $j$ ($1 \le j \le m$) contains two integers separated by spaces, representing the position of the initial point $(x_j, y_j)$ after the $n$ operations.
Explanation/Hint
### Sample Explanation
After three operations, the first point $(1, -1)$ becomes $(21, -11)$; the second point $(0, 0)$ becomes $(20, -10)$.
### Subtasks
All testdata satisfies: $n, m \le 100$, and all input values $(x, y, dx, dy)$ are integers with absolute values not exceeding $10^5$.
Translated by ChatGPT 5