CHAOS_CC - Chaos In Arkham

no tags 

Mayhem has struck Arkham Asylum!
Both Bane and Joker are running free in Arkham and rescuing other prisoners. The prison of Arkham consists of N cells in a row. To decide who is superior, they play the following game: Both take turns alternately, and in each turn a player can open any one cell of the prison. They define a block of 3 consecutive open prison cells as a "crime hole". The first one to create a "crime hole" wins and is declared as the Ultimate Villain of Gotham. Joker plays first.
As we know Bruce Wayne always keeps track of his enemies. In this situation he needs a program to decide who will emerge as the Ultimate Villain if both play optimally.


First line of input contains number of Test Cases T, followed by T lines. On each line you are given a single integer N, depicting the number of enemy camps.


For each N, print "Bane" if Bane wins, else print "Joker". (Quotes for clarity)


1 <= T <= 3333
3 <= N <= 3333







Let us denote the open cells by 'o' and closed cells by '-'.
Case one: Initially all cells are closed(---), if Joker opens first cell configuration is (o--). Bane can either open second cell leading to configuration (oo-) or third cell (o-o). In both cases Joker wins.
Case two: Joker wins by opening the 3rd cell i.e. configuration (--o--).

hide comments
RADHS: 2013-03-31 18:50:11

Could We have some more test cases and output?

Pradep Kumar: 2013-02-20 08:46:51

There is no crime hole in o-o or oo- examples given in the Explanation as crime holes are of size 3. How does the Joker win in these cases ?

Added by:smit hinsu
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:CodeCraft 13 , Author : Nikhil Goyal