All submissions for this problem are available.
Read problems statements in Russian here
Little Chef is trying to learn exponents. He is especially interested in a number raised to the power of itself. Head Chef being his mentor has decided to give him a two player game to play. The game is as follows: You are given n piles of stones. The piles have a_1, a_2 .. a_n number of stones . Each player on his/her turn can remove x number of stones where x = n^n (for some natural number n > 0) from any one pile. The player who is unable to move loses. Head Chef is playing this game with the Little Chef and being senior he gives the first move to the Little Chef .
- The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows:
- The first line of each test case contains a single integer N denoting the number of piles. The second line contains N space-separated integers A1, A2, ..., AN denoting the number of stones in each pile.
- For each test case, output a single line containing the string "Head Chef" if Head Chef will win the game or the string "Little Chef" is Little Chef will win the game (assuming optimal play by both players).
- 1 ≤ T ≤ 100
- 1 ≤ N ≤ 100
- 1 ≤ a_i ≤ 100000
Input: 1 1 4 Output: Little Chef
Example case 1. Little Chef can remove all the four stones and Head Chef will lose.
Subtask 1 (16 points): N = 1
Subtask 2 (24 points): N = 2
Subtask 3 (60 points): See constraints
|Tags||easy-medium, game-theory, impartial-game, ltime05, sprague-grundy, vineetpaliwal, zero-sum-game|
|Time Limit:||0.1 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.