Stone GameProblem code: RESN04 |
All submissions for this problem are available.
Alice and Bob play the following game : There are N piles of stones with Si stones in the ith pile. Piles are numbered from 1 to N. Alice and Bob play alternately, with Alice starting. In a turn, the player chooses any pile i which has atleast i stones in it, and removes exactly i stones from it. The game ends when there is no such pile. The player who plays last wins the game. Assuming Alice and Bob play optimally, who will win the game?
Input
The first line contains the number of test cases T (<= 100). There follow 2T lines, 2 per test case. The first line of each test case conains N (<= 100), the number of piles. The second line contains N space seperated integers, specifying the number of stones in pile 1, pile 2, ..., pile N. There will be atleast 1 and atmost 1000 stones in any pile.
Output
Output T lines, one per test case. For each test case, output "ALICE" if Alice wins the game, and "BOB" if Bob wins the game.
Example
Input: 2 1 1 2 1 1 Output: ALICE ALICE
| Date: | 2009-12-18 |
| Time limit: | 5s |
| Source limit: | 50000 |
| Languages: | C C99 strict C++ 4.0.0-8 C++ 4.3.2 PAS gpc PAS fpc JAVA NICE JAR C# C#2 NEM ST ASM D FORT ADA BASH PERL PYTH RUBY LUA ICON PIKE PHP SCM guile SCM qobi LISP sbcl LISP clisp SCALA HASK ERL CAML CLPS PRLG WSPC BF ICK JS |
Comments

Fetching successful submissions

We are unable to submit our
We are unable to submit our solution. It shows "restricted content" error. Kindly reiterate the login procedure.
ya.. even we are facing the
ya.. even we are facing the same problem.. could you please look into this??
Even we are facing the same
Even we are facing the same problem.
Login using resnk_OLDID.
Login using resnk_OLDID. Using prsnk_ won't let you submit.
What is wrong with the
What is wrong with the submission part ..
RESTRICTED CONTENT showing .. not single submission can be made
Please read the contest
Please read the contest updates. Login with your id equal to resnk_OLDSNACKDWNID with the same password. We had sent out a mail regarding the same.
cannot submit restricted
cannot submit restricted content is showing i have userid dce and according to you i have tried it with resnk_dce but it is not showing anything please help as soon as possible
I don't think that your team
I don't think that your team is eligible for this contest. Did you solve atleast 1 problem in the SNACKDWN contest?