DCP-10: Mina and Raju Back to All Problems

Medium Game Theory > Minimax

Mina and Raju love to play interesting games. One day while playing Raju invents a wonderful game. Initially there are R marbles on the table. In a single move Mina and Raju can remove the marbles from the table. But there are rules to follow while playing. For Mina there are **m** types of legal moves and for Raju, there are **n** types of legal moves which are set by Mithu randomly. Say there are 10 marbles initially. Mithu set that there are 2 types of legal moves for Mina and in a single move she can either remove 1 or 3 marbles from the table and 3 types of legal moves for Raju and in a single move he can remove 2 , 4 or 5 marbles from the table same as Mina . You can assume that if n + m = 5 then all legal moves are between 1 to 5 but randomly distributed among Mina and Raju by Mithu . They play alternately and the winner is the one who take the last marble from the table or loser is the one who can’t take marble from the table. Mina always starts and both of them play optimally. Input: ------ Input consists of a number of test cases **T (T <= 1000)** and each case starts with three integer numbers **R** (initial number of marbles in the table), **m** (legal moves for Mina), **n** (legal moves for Raju). The next line contains m space separated integers forming legal moves of Mina and very next line contains n space separated integers forming legal moves of Raju. Output: ------- For each input, output one line saying either “Mina wins” or “Raju wins”. Constrains: ----------- T <= 1000 R <= 1000 n + m <= 15 Sample Input ------------ 2 10 2 3 1 3 2 4 5 2 1 1 2 1 Sample Output ------------- Raju wins Mina wins

Problem Setter:

Shakil Ahmed

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 1.00
C++ 1.00
C++14 1.00
C# 2.00
Go 2.00
Java 2.00
JavaScript 2.00
Objective-C 2.00
Perl 2.00
PHP 2.00
Python 2.00
Python3 2.00
Ruby 2.00
VB.Net 2.00

Problem Stats




# User Language Timing
01 seyedssz Cpp14 0.04s
02 ImagineWarrior Cpp14 0.34s
03 INUA Cpp14 0.43s

Your feedback is our precious!

Or call +88 02 9853138 for support