Younger BrotherProblem code: CHEFBRO |
All submissions for this problem are available.
Chef's younger brother is in town. He's a big football fan and has a very important match to watch tonight. But the Chef wants to watch the season finale of MasterChef which will be aired at the same time. Now they don't want to fight over it like they used to when they were little kids. They want to decide it in a fair way. So they agree to play a game to make a decision. Their favourite childhood game!
The game consists of C boards. Each board i is a grid of dimension ni x mi.
Rules of the game:
- A coin is placed at (1,1) on every board initially.
- Each one takes a turn alternatively.
- In one turn, a player can choose any one board and move a coin from a cell (i,j) to one of the following cells:
(i+1,j) OR (i+2,j) OR (i,j+1) OR (i,j+2) OR (i+1,j+1) OR (i+2,j+2).
- A coin cannot be moved out of the board at any point during the game.
- A coin cannot be moved once it reaches the cell (n,m) where n and m are the dimensions of the board of that coin.
- A player MUST make one valid move.
- The player who makes the last move gets to watch TV.
Both of them are passionate about their interests and want to watch their respective shows. So they will obviously make optimal moves in every turn. The Chef, being the elder brother, takes the first turn.
Your task is to predict which show they will be watching tonight.
Input:
The first line of input contains a single integer T, the number of test cases. T tests follow.Each test case starts with a single line containing C, the number of boards in the game. Then follow C lines: each containing 2 integers ni and mi, the dimensions of the ith board.
Output:
Given the number and dimensions of boards, for each test case, output in a single line: "MasterChef" if the Chef wins or "Football" if his brother wins.
Constraints:
1<=T<=10000
1<=C<=20
2<=ni,mi<=1000
Example:
Input:
1
1
2 2
Output:
MasterChef
Explanation:
The Chef can move the coin on the board from (1,1)->(2,2). This coin cannot be moved any further. And so, the Chef wins. Notice that if the Chef moves it to any other valid position, i.e. either to (1,2) or (2,1) he will lose!
| Author: | vamsi_kavala |
| Date Added: | 25-07-2011 |
| Time Limit: | 1 sec |
| Source Limit: | 50000 Bytes |
| Languages: | ADA, ASM, BASH, BF, C, C99 strict, CAML, CLOJ, CLPS, CPP 4.0.0-8, CPP 4.3.2, CS2, D, ERL, F#, FORT, GO, HASK, ICK, ICON, JAR, JAVA, JS, LISP clisp, LISP sbcl, LUA, NEM, NICE, PAS fpc, PAS gpc, PERL, PERL6, PHP, PIKE, PRLG, PYTH, PYTH 3.1.2, RUBY, SCALA, SCM guile, SCM qobi, ST, TCL, TEXT, WSPC |
Comments

Fetching successful submissions

what if c is even and both
if any coin reached the
"The player who makes the
what is a c board like??
example given is too easy to
^ There are 'C' number of
very very weak test case...
this two are not meaning full
Whats with 'C' boards in a
they choose any board to make
@amriteshanand The last
@lg5293: how to calculate the
thanx... for the direction..
@paramanantham you don't need
@lg5293 You got it right in
give more testcases.
Is board of size 1x1 a valid
Sorry, didn't saw the limits
@admin: players play
I know my algorithm is
*Example
@curiosity They play
@lg5293: Your response is
Can the size of different
@coolnirdh, ok sorry for
@lg5293: Thanks for the
Well I know its the wrong
accepted.. :)))
anyone kindly post a correct
how we have to select the
@alexmj26...is your answer
Can any1 gv me sum sample
My problem ID is
ignore my last questons..i
what does optimal moves
@admin...this tym i am
@deeee: The players make
ok..Thanx...
i cant even figure out for
how is everyone making
Not sure why it is happening
@moody, try to figure it out
OK, got accepted, I was wrong
i wonda whr m makin a
I saw many people getting WA,
It is a request to all.
can someone tell me the o/p
@siddharth_i is the answer
@admin: can you please check
@siddarth_I - i m gettin
@ Admin - Please have a look
Can any one tell me whether
at lg5293: yeah i know... its
hey what is the out put
sorry i meant for four test
@Everyone: The homepage of
@admin : In a scenario let
@gaurav: Making a last move
@karthikabinav: The output
I am new to CodeChef , i dont
on each board chef move first
can any one post more test
Plz give 1 or 2 more test
can anyone explain winner in
@admin I submitted the source
@ admin : Could you tell the
@admin: can i get any other
Admin, would you please
Hi Will u kindly tell me how
@admin, plz check d solutn i
@admin, plz check d solutn i