CF1866I.Imagination Castle

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Given a chessboard of size N×MN \times M ( NN rows and MM columns). Each row is numbered from 11 to NN from top to bottom and each column is numbered from 11 to MM from left to right. The tile in row rr and column cc is denoted as (r,c)(r,c) . There exists KK distinct special tiles on the chessboard with the ii -th special tile being tile (Xi,Yi)(X_i,Y_i) . It is guaranteed that tile (1,1)(1,1) is not a special tile.

A new chess piece has been invented, which is the castle. The castle moves similarly to a rook in regular chess, but slightly differently. In one move, a castle that is on some tile can only move to another tile in the same row or in the same column, but only in the right direction or the down direction. Formally, in one move, the castle on tile (r,c)(r,c) can only move to tile (r,c)(r',c') if and only if one of the following two conditions is satisfied:

  • r=rr'=r and c>cc'>c .
  • c=cc'=c and r>rr'>r .

Chaneka and Bhinneka will play a game. In the beginning of the game, there is a castle in tile (1,1)(1,1) . The two players will play alternatingly with Chaneka going first. In one turn, the player on that turn must move the castle following the movement rules of the castle.

If a player moves the castle to a special tile on her turn, then that player wins the game and the game ends. If on a turn, the castle cannot be moved, the player on that turn loses and the game ends.

Given the size of the board and the locations of each special tile. Determine the winner of this game if Chaneka and Bhinneka plays optimally.

输入格式

The first line contains three integers NN , MM , and KK ( 1N,M21051 \leq N,M \leq 2 \cdot 10^5 ; 0Kmin(N×M1,2105)0 \leq K \leq \min(N \times M - 1, 2\cdot10^5) ) — the size of the chessboard and the number of special tiles.

The ii -th of the next KK lines contains two integers XiX_i and YiY_i ( 1XiN1\leq X_i\leq N ; 1YiM1\leq Y_i\leq M ; (Xi,Yi)(1,1)(X_i, Y_i) \neq (1,1) ) — the location of each special tile. The special tiles are pairwise distinct.

输出格式

Output Chaneka if Chaneka is the winner, output Bhinneka if Bhinneka is the winner.

输入输出样例

  • 输入#1

    4 5 3
    1 3
    4 4
    1 5

    输出#1

    Chaneka
  • 输入#2

    2 2 0

    输出#2

    Bhinneka

说明/提示

In the first example, the following is an illustration of the chessboard in the beginning of the game.

Chaneka can move the castle to special tile (1,3)(1,3) or (1,5)(1,5) directly on her first turn. Therefore, Chaneka is the winner.

In the second example, the following is an illustration of the chessboard in the beginning of the game.

Chaneka can only move the castle to tile (1,2)(1, 2) or (2,1)(2, 1) on her first turn. Whatever Chaneka does, Bhinneka will be able to directly move the castle to tile (2,2)(2, 2) . After that, on Chaneka's turn, she cannot move the castle, so Chaneka loses. Therefore, Bhinneka is the winner.

首页