#P15661. [ICPC 2025 Jakarta R] Grid Game 2×2

[ICPC 2025 Jakarta R] Grid Game 2×2

题目描述

There is a 109×10910^9 \times 10^9 grid, with rows numbered from 11 to 10910^9 and columns numbered from 11 to 10910^9. Denote (r,c)(r, c) as the cell at row rr and column cc.

Initially, exactly NN of the cells are black, and the rest are white. The ii-th black cell is located at (Ri,Ci)(R_i, C_i).

Your childhood friends, Kita and Kami, will alternately take turns playing on this grid, with Kita moving first. A turn in the game proceeds as follows.

  • Pick a black cell (r,c)(r, c).
  • Pick a subset K{1,2,,t}K \subseteq \{1, 2, \ldots, t\} where tt is the largest integer such that 2tmin(r,c)2^t \leq \min(r, c). The set KK may be empty.
  • For each kKk \in K, toggle the colour of all\textbf{all} cells (ri,cj)(r-i, c-j) satisfying 0i<2k0 \leq i < 2^k, 0j<2k0 \leq j < 2^k, and (i,j)(0,0)(i, j) \neq (0, 0). Toggling a colour means changing black colour to white and vice versa.
  • Toggle the colour of cell (r,c)(r, c). Note that the colour of cell (r,c)(r, c) becomes white after the toggle.

A player who is unable to play on their turn, i.e., there are no black cells anymore, loses the game, and the opposing player wins the game. If both players play optimally, determine who will win the game.

输入格式

The first line contains an integer NN (1N2000001 \leq N \leq 200\,000) representing the number of black cells.

Each of the next NN lines contains two integers RiR_i and CiC_i (1Ri,Ci1091 \leq R_i, C_i \leq 10^9) representing the location of the ii-th black cell. All the given black cells are different.

输出格式

Output one line, containing either Kita\texttt{Kita} if the first player will win the game, or Kami\texttt{Kami} otherwise.

4
1 2
1 3
2 2
2 3
Kita
1
8 8
Kita
2
2 4
4 2
Kami

提示

Explanation of Sample 1:\textit{Explanation of Sample 1:} The first player picks the cell (2,3)(2, 3) and the set K={1}K = \{ 1 \} and all the cells become white afterwards.

Explanation of Sample 2:\textit{Explanation of Sample 2:} The first player picks the cell (8,8)(8, 8) and the set KK as an empty set, and the only black cell becomes white afterwards.

Explanation of Sample 3:\textit{Explanation of Sample 3:} The second player can always mirror the last move made by the first player.