#C9018. Optimal Hub Coordinates

    ID: 53065 Type: Default 1000ms 256MiB

Optimal Hub Coordinates

Optimal Hub Coordinates

You are given a number of test cases. For each test case, you are provided an integer (n) which represents the number of additional coordinates to be assigned to a hub network. Your task is to output a list of coordinates for each test case in the following order:

  1. First, output the number (2) on a single line.
  2. Then, output the coordinate ((0, 0)) on a new line.
  3. Next, based on the value of (n), output additional coordinates as follows:
    • If (n = 1), output the coordinate ((2, 0)).
    • If (n = 2), output the coordinates ((2, 0)) and ((0, 2)).
    • If (n = 3), output the coordinates ((1, 1)), ((1, -1)), and ((-1, 0)).
    • If (n = 4), output the coordinates ((2, 0)), ((0, 2)), ((2, 2)), and ((0, -2)).
    • If (n \ge 5), for each integer (i) from (1) to (n), if (i) is odd, output ((i, i)); if (i) is even, output ((-i, i)).

The output for all test cases is the concatenation of the results from each test case without any additional separators. Each coordinate should be printed on a new line. For a one-element coordinate (a singleton tuple), print only the number; for a pair, print both numbers separated by a space.

The objective is to simulate the assignment process of coordinates, ensuring that the above rules are followed exactly.

inputFormat

The input is provided via standard input (stdin). The first number is an integer (t) representing the number of test cases. This is followed by (t) integers, each representing the value (n) for a test case. All numbers are separated by whitespace.

For example:

2 3 4

outputFormat

For each test case, output the corresponding coordinates in the order specified. Each coordinate should be printed on a separate line. If the coordinate is a single number (i.e. a one-element tuple), print that number alone; if it is a pair, print the two numbers separated by a single space.

For instance, the output for the input example would be:

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

2 3 4
2

0 0 1 1 1 -1 -1 0 2 0 0 2 0 0 2 2 2 0 -2

</p>