Knowee
Questions
Features
Study Tools

If you want to buy a new cellular phone, there are many various types to choose from. To decide which one is the best for you, you have to consider several important things: its size and weight, battery capacity, WAP support, colour, price. One of the most important things is also the list of games the phone provides. Nokia is one of the most successful phone makers because of its famous Snake and Snake II. ACM wants to make and sell its own phone and they need to program several games for it. One of them is Master-Mind, the famous board logical game.The game is played between two players. One of them chooses a secret code consisting of P ordered pins, each of them having one of the predefined set of C colours. The goal of the second player is to guess that secret sequence of colours. Some colours may not appear in the code, some colours may appear more than once.The player makes guesses, which are formed in the same way as the secret code. After each guess, he/she is provided with an information on how successful the guess was. This feedback is called a hint. Each hint consists of B black points and W white points. The black point stands for every pin that was guessed right, i.e. the right colour was put on the right position. The white point means right colour but on the wrong position. For example, if the secret code is "white, yellow, red, blue, white" and the guess was "white, red, white, white, blue", the hint would consist of one black point (for the white on the first position) and three white points (for the other white, red and blue colours). The goal is to guess the sequence with the minimal number of hints.The new ACM phone should have the possibility to play both roles. It can make the secret code and give hints, but it can also make its own guesses. Your goal is to write a program for the latter case, that means a program that makes Master-Mind guesses.InputThere is a single positive integer T on the first line of input. It stands for the number of test cases to follow. Each test case describes one game situation and you are to make a guess. On the first line of each test case, there are three integer numbers, P, C and M. P ( 1 <= P <= 10) is the number of pins, C (1 <= C <= 100) is the number of colours, and M (1 <= M <= 100) is the number of already played guesses.Then there are 2 x M lines, two lines for every guess. At the first line of each guess, there are P integer numbers representing colours of the guess. Each colour is represented by a number Gi, 1 <= Gi <= C. The second line contains two integer numbers, B and W, stating for the number of black and white points given by the corresponding hint.Let's have a secret code S1, S2, ... SP and the guess G1, G2, ... GP. Then we can make a set H containing pairs of numbers (I,J) such that SI = GJ, and that any number can appear at most once on the first position and at most once on the second position. That means for every two different pairs from that set, (I1,J1) and (I2,J2), we have I1 <> I2 and J1 <> J2. Then we denote B(H) the number of pairs in the set, that meet the condition I = J, and W(H) the number of pairs with I <> J.We define an ordering of every two possible sets H1 and H2. Let's say H1 <= H2 if and only if one of the following holds:B(H1) < B(H2), orB(H1) = B(H2) and W(H1) <= W(H2)Then we can find a maximal set Hmax according to this ordering. The numbers B(Hmax) and W(Hmax) are the black and white points for that hint.OutputFor every test case, print the line containing P numbers representing P colours of the next guess. Your guess must be valid according to all previous guesses and hints. The guess is valid if the sequence could be a secret code, i.e. the sequence was not eliminated by previous guesses and hints.If there is no valid guess possible, output the sentence You are cheating!. If there are more valid guesses, output the one that is lexicographically smallest. I.e. find such guess G that for every other valid guess V there exists such a number I that:GJ = VJ for every J<I, andGI<VI.ExampleSample Input:34 3 21 2 3 21 12 1 3 21 14 6 23 3 3 33 04 4 4 42 08 9 31 2 3 4 5 6 7 80 02 3 4 5 6 7 8 91 03 4 5 6 7 8 9 92 0Sample Output1 1 1 3You are cheating!9 9 9 9 9 9 9 9

Question

If you want to buy a new cellular phone, there are many various types to choose from. To decide which one is the best for you, you have to consider several important things: its size and weight, battery capacity, WAP support, colour, price. One of the most important things is also the list of games the phone provides. Nokia is one of the most successful phone makers because of its famous Snake and Snake II. ACM wants to make and sell its own phone and they need to program several games for it. One of them is Master-Mind, the famous board logical game.The game is played between two players. One of them chooses a secret code consisting of P ordered pins, each of them having one of the predefined set of C colours. The goal of the second player is to guess that secret sequence of colours. Some colours may not appear in the code, some colours may appear more than once.The player makes guesses, which are formed in the same way as the secret code. After each guess, he/she is provided with an information on how successful the guess was. This feedback is called a hint. Each hint consists of B black points and W white points. The black point stands for every pin that was guessed right, i.e. the right colour was put on the right position. The white point means right colour but on the wrong position. For example, if the secret code is "white, yellow, red, blue, white" and the guess was "white, red, white, white, blue", the hint would consist of one black point (for the white on the first position) and three white points (for the other white, red and blue colours). The goal is to guess the sequence with the minimal number of hints.The new ACM phone should have the possibility to play both roles. It can make the secret code and give hints, but it can also make its own guesses. Your goal is to write a program for the latter case, that means a program that makes Master-Mind guesses.InputThere is a single positive integer T on the first line of input. It stands for the number of test cases to follow. Each test case describes one game situation and you are to make a guess. On the first line of each test case, there are three integer numbers, P, C and M. P ( 1 <= P <= 10) is the number of pins, C (1 <= C <= 100) is the number of colours, and M (1 <= M <= 100) is the number of already played guesses.Then there are 2 x M lines, two lines for every guess. At the first line of each guess, there are P integer numbers representing colours of the guess. Each colour is represented by a number Gi, 1 <= Gi <= C. The second line contains two integer numbers, B and W, stating for the number of black and white points given by the corresponding hint.Let's have a secret code S1, S2, ... SP and the guess G1, G2, ... GP. Then we can make a set H containing pairs of numbers (I,J) such that SI = GJ, and that any number can appear at most once on the first position and at most once on the second position. That means for every two different pairs from that set, (I1,J1) and (I2,J2), we have I1 <> I2 and J1 <> J2. Then we denote B(H) the number of pairs in the set, that meet the condition I = J, and W(H) the number of pairs with I <> J.We define an ordering of every two possible sets H1 and H2. Let's say H1 <= H2 if and only if one of the following holds:B(H1) < B(H2), orB(H1) = B(H2) and W(H1) <= W(H2)Then we can find a maximal set Hmax according to this ordering. The numbers B(Hmax) and W(Hmax) are the black and white points for that hint.OutputFor every test case, print the line containing P numbers representing P colours of the next guess. Your guess must be valid according to all previous guesses and hints. The guess is valid if the sequence could be a secret code, i.e. the sequence was not eliminated by previous guesses and hints.If there is no valid guess possible, output the sentence You are cheating!. If there are more valid guesses, output the one that is lexicographically smallest. I.e. find such guess G that for every other valid guess V there exists such a number I that:GJ = VJ for every J<I, andGI<VI.ExampleSample Input:34 3 21 2 3 21 12 1 3 21 14 6 23 3 3 33 04 4 4 42 08 9 31 2 3 4 5 6 7 80 02 3 4 5 6 7 8 91 03 4 5 6 7 8 9 92 0Sample Output1 1 1 3You are cheating!9 9 9 9 9 9 9 9

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

This problem is about creating a program for the game Master-Mind to be played on a new phone by ACM. The game involves one player creating a secret code of colored pins and the other player trying to guess the code. The guesser receives hints in the form of black and white

Similar Questions

A company switched cellular carriers and realized their existing cell phones are not compatible because they do not have a slot for a SIM card. What cellular standard do the phones not support?a.CDMAb.GSMc.5Gd.1G

give me the list of phone models with the following configurations - 5g phone with 8GB RAM, 128GB storage, 6000mah battery with 60 watt or above fast charging, snapdragon processor, android version 13 with 5 years security updates and 4 gen of OS updates, 120hz LCD display, with 600 nits cost price

Explain the key differences of three types ofMobile App Architectures.

The cell phone division of a multinational corporation has granted its research and development department funds to create new technologies to ensure the organization stays ahead of its competitors in the market. This decision by the cell phone division is an example of the organization's _____ strategy.Multiple Choicetop-levelbusiness-levelfunctional-leveldepartmental-level

Consider the technology choices for a new phone handset for the iPhone and Galaxy by their respective head companies. Both firms can simultaneously choose either technology 1 (T1) or technology 2 (T2). The payoffs from a choice of (T1, T1) is 20 for each firm (note that the first term relates to Galaxy and the second iPhone). If both firms go for T2, the payoffs are 30 for each firm. If the strategies adopted are (T2, T1), the payoffs are (50, 80). Finally, if the strategies adopted are (T1, T2) the payoffs are (60, 70) for Galaxy and iPhone respectively. Which statement is true?Group of answer choicesThe Nash equilibrium is (T1, T1)The Nash equilibrium is (T2, T2)The Nash equilibrium is (T1, T2)The Nash equilibria are (T1, T1) and (T2, T2); this is an example of firms adopting a minimal product differentiation strategy.The Nash equilibria are (T2, T1) and (T1, T2); this is an example of firms adopting a maximal differentiation strategy.

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.