#P8154. Chessboard Line Puzzle

    ID: 21336 Type: Default 1000ms 256MiB

Chessboard Line Puzzle

Chessboard Line Puzzle

You are given an infinite chessboard (which may be identified with the integer lattice (\mathbb{Z}^2)) and exactly (n) black pieces and (n) white pieces. Your task is to place all (2n) pieces on distinct lattice points so that there exist exactly (n) straight lines with the following property:

Each line passes through exactly four pieces (and no more) when considered over all (2n) pieces, and the pieces lie along the line in the precise order: black, white, white, black (when traversed in one of the two possible directions along the line).

It can be proved that a solution always exists. You only need to output any one valid arrangement.

inputFormat

The input consists of a single integer (n) (where (n \ge 1)) on a line, representing the number of black pieces (and also white pieces).

outputFormat

Output a valid arrangement of the pieces. The output should contain (2n) lines. The first (n) lines describe the coordinates of the black pieces and the next (n) lines describe the coordinates of the white pieces. Each line should contain two space‐separated integers (x) and (y) (i.e. the coordinates of that piece). The arrangement must satisfy the requirement that there exist exactly (n) distinct lines, each containing exactly four of the given pieces in the order: black, white, white, black. (If a line is traversed in the opposite direction the order is reversed, but that is acceptable as long as the two black pieces are at the two ends and the two white pieces are in the middle.)

sample

4
0 0

6 0 6 6 0 6 2 0 6 2 4 6 0 4

</p>