##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
| # | Title | Points | Solved | Admin | |
|---|---|---|---|---|---|
There is an infinite grid. A cell is identified by a pair of integer coordinates .
A domino covers exactly two cells sharing a side. There are two types of dominoes:
In both cases, is the cell of the domino with the smallest coordinates.
You are given operations. Each operation either adds a new domino to the grid or removes an existing domino from the grid. The operations are valid: an added domino is placed on two currently empty cells, and a removed domino is currently present.
For every added domino, choose a color for it: one of .
After every operation, for every two dominoes that are both present in the grid and have two cells sharing a side, their colors must be different.
Each is either +, meaning add a domino, or -, meaning remove a domino.
Each denotes the type of the domino: for cells and , and for cells and .
For every operation with +, output one integer: the color assigned to the newly added domino.
If there are add operations, the output format is:
The colors must be given in the same order as the add operations.
Each color must be an integer between and .
There are 8 add operations, so the output contains 8 colors.
The first domino has no active neighbor, so color 1 is valid.
The second domino is adjacent to the first one and receives color 2, so they have different colors.
The third domino is adjacent to the first one and receives color 3.
The fourth domino is adjacent to the first and second dominoes, and color 3 is different from the colors of both active adjacent dominoes.
After removing the second domino, the fifth added domino receives color 1. It is adjacent to the fourth domino, whose color is 3.
The sixth added domino receives color 2 and is adjacent to the third domino, whose color is 3.
After removing the third domino, the seventh added domino receives color 4. Its active adjacent dominoes have colors 1 and 3.
The last added domino receives color 2. Its only active adjacent domino has color 1.