MAIN73 - Manoj and Pankaj
Manoj and Pankaj play the following game on a N*M grid, Each cell of which is either empty or contain a stone.
Each player in his his turn must take one the two moves described below:-
1. He can shift an stone to its adjacent right cell, if that cell is empty
2. He can remove a stone completely from the grid.
1st player who is unable to take a move looses the game . It is also given that both the players will play optimally and Manoj always take the first turn.
You have to find who will win the game.
First line of each test case contains two integers N and M. (1<=N,M<=200) Each of next N lines contains an string, jth character on of ith string is '*' if there is an stone otherise it is '.' (empty). Input ends when N, M = 0,0. which is not to be processed.
For each test case print 'Manoj' if Manoj wins, print 'Pankaj' otherwise.
Input: 2 2 .* .* 2 2 .* *. 0 0
Output: Pankaj Manoj
Mahesh Chandra Sharma:
@V0iD! Manoj will shift the lower stone to right then Pankaj will have no choice other than removing an stone then in the 3rd move Manoj will also remove an stone and wins!
In the second test case, if Manoj removes a stone, followed by Pankaj removing a stone, Manoj loses, right?? Or am I missing something?
can be removed during any time
Can a stone be removed only after it has reached the right end or during anytime of the game?