#K64867. Meteor Position Predictor

    ID: 32071 Type: Default 1000ms 256MiB

Meteor Position Predictor

Meteor Position Predictor

You are given a set of meteors, each with an initial position and a constant velocity vector. For each query, you need to predict the position of each meteor at a given time t.

The position of a meteor at time t is given by the formulas:

$$ x(t)=x+v_x\times t \quad \text{and} \quad y(t)=y+v_y\times t $$

For each test case, the input contains:

  • An integer N representing the number of meteors.
  • N lines each containing four integers: x y vx vy.
  • An integer Q representing the number of queries.
  • Q lines each containing an integer t (time).

Your task is to compute the position of every meteor at each queried time and output the results.

inputFormat

The input is read from stdin in the following format:

T
N
x y vx vy
... (repeated N times)
Q
t₁
... (repeated Q times)
... (repeated for T test cases)

Where:

  • T is the number of test cases.
  • N is the number of meteors in each test case.
  • Each meteor is described by four integers: its initial x and y positions and its velocity components vx and vy.
  • Q is the number of queries for that test case, and each query consists of a time value t.

outputFormat

For each query, output the positions of all meteors. For a given query, each meteor's position is output on a separate line in the format:

x y

Separate the outputs of different queries with an empty line. The output should be written to stdout.

## sample
1
2
0 0 1 1
1 -1 -1 0
2
1
2
1 1

0 -1

2 2 -1 -1

</p>