Estado:  Pasado  Inicio:  20141004 12:30:00  Fin:  20141004 16:30:00 
The 2014 ACMICPC Caribbean National Contests (Real contest)
Problema
2950  Cows & Bulls
Creado por  Orlenys López Pintado 
Adicionado por  kko (20140611) 
Límites 
Tiempo Total: 20000 MS

Tiempo Caso:
2000 MS
Memoria: 62 MB  Salida límite (mb): 64 MB  Tamaño:
14 KB

Lenguajes activados  
Disponible en 
Descripción
“Cows and bulls” is a very popular twoplayer game among Cuban students. Each player begins by secretly forming a four digit number without leading zeros and using exactly four distinct digits. The goal of the game is to guess the opponent's hidden number. The players take turns. In her turn, a player will write down a number and the opponent will count how many cows and bulls the guessed number contain. A bull is a digit found in the opponent's number that is placed at the same position. Similarly, a cow is a digit contained in the secret number but at another place. The player who guesses the opponent's number first wins the game.
Little Kenny is tired of losing to his big brother Kevin. Given the sequence of moves already played by Kevin, he needs you to write a program that computes the numbers he must choose in order to win.
Because Kenny and Kevin are both children, they added a simplifying rule: cows and bulls will be revealed after each round.
Little Kenny is tired of losing to his big brother Kevin. Given the sequence of moves already played by Kevin, he needs you to write a program that computes the numbers he must choose in order to win.
Because Kenny and Kevin are both children, they added a simplifying rule: cows and bulls will be revealed after each round.
“Cows and bulls” is a very popular twoplayer game among Cuban students. Each player begins by secretly forming a four digit number without leading zeros and using exactly four distinct digits. The goal of the game is to guess the opponent's hidden number. The players take turns. In her turn, a player will write down a number and the opponent will count how many cows and bulls the guessed number contain. A bull is a digit found in the opponent's number that is placed at the same position. Similarly, a cow is a digit contained in the secret number but at another place. The player who guesses the opponent's number first wins the game.
Little Kenny is tired of losing to his big brother Kevin. Given the sequence of moves already played by Kevin, he needs you to write a program that computes the numbers he must choose in order to win.
Because Kenny and Kevin are both children, they added a simplifying rule: cows and bulls will be revealed after each round.
Little Kenny is tired of losing to his big brother Kevin. Given the sequence of moves already played by Kevin, he needs you to write a program that computes the numbers he must choose in order to win.
Because Kenny and Kevin are both children, they added a simplifying rule: cows and bulls will be revealed after each round.
“Cows and bulls” is a very popular twoplayer game among Cuban students. Each player begins by secretly forming a four digit number without leading zeros and using exactly four distinct digits. The goal of the game is to guess the opponent's hidden number. The players take turns. In her turn, a player will write down a number and the opponent will count how many cows and bulls the guessed number contain. A bull is a digit found in the opponent's number that is placed at the same position. Similarly, a cow is a digit contained in the secret number but at another place. The player who guesses the opponent's number first wins the game.
Little Kenny is tired of losing to his big brother Kevin. Given the sequence of moves already played by Kevin, he needs you to write a program that computes the numbers he must choose in order to win.
Because Kenny and Kevin are both children, they added a simplifying rule: cows and bulls will be revealed after each round.
Little Kenny is tired of losing to his big brother Kevin. Given the sequence of moves already played by Kevin, he needs you to write a program that computes the numbers he must choose in order to win.
Because Kenny and Kevin are both children, they added a simplifying rule: cows and bulls will be revealed after each round.
Especificación de entrada
Line 1: An integer N (1 <= N <= 7) indicating the number of rounds already played by Kenny.
Lines 2 … N + 1: Each line will contain the information of a round. A round is described by a four digit number (without leading zeros and comprising four different digits). Then, there will be two integers C and B, the number of cows and bulls, respectively. C digits will follow and then B other digits.
Lines 2 … N + 1: Each line will contain the information of a round. A round is described by a four digit number (without leading zeros and comprising four different digits). Then, there will be two integers C and B, the number of cows and bulls, respectively. C digits will follow and then B other digits.
Line 1: An integer N (1 <= N <= 7) indicating the number of rounds already played by Kenny.
Lines 2 … N + 1: Each line will contain the information of a round. A round is described by a four digit number (without leading zeros and comprising four different digits). Then, there will be two integers C and B, the number of cows and bulls, respectively. C digits will follow and then B other digits.
Lines 2 … N + 1: Each line will contain the information of a round. A round is described by a four digit number (without leading zeros and comprising four different digits). Then, there will be two integers C and B, the number of cows and bulls, respectively. C digits will follow and then B other digits.
Line 1: An integer N (1 <= N <= 7) indicating the number of rounds already played by Kenny.
Lines 2 … N + 1: Each line will contain the information of a round. A round is described by a four digit number (without leading zeros and comprising four different digits). Then, there will be two integers C and B, the number of cows and bulls, respectively. C digits will follow and then B other digits.
Lines 2 … N + 1: Each line will contain the information of a round. A round is described by a four digit number (without leading zeros and comprising four different digits). Then, there will be two integers C and B, the number of cows and bulls, respectively. C digits will follow and then B other digits.
Especificación de salida
Write a line for each possible number Kenny may guess, taking into consideration all the information his opponent has given him. These numbers must be printed in increasing order.
Write a line for each possible number Kenny may guess, taking into consideration all the information his opponent has given him. These numbers must be printed in increasing order.
Line 1: An integer N (1 <= N <= 7) indicating the number of rounds already played by Kenny.
Lines 2 … N + 1: Each line will contain the information of a round. A round is described by a four digit number (without leading zeros and comprising four different digits). Then, there will be two integers C and B, the number of cows and bulls, respectively. C digits will follow and then B other digits.
Lines 2 … N + 1: Each line will contain the information of a round. A round is described by a four digit number (without leading zeros and comprising four different digits). Then, there will be two integers C and B, the number of cows and bulls, respectively. C digits will follow and then B other digits.
Ejemplo de entrada
2
2345 0 3 2 4 5
1654 2 0 4 5
Ejemplo de salida
2045
2745
2845
2945