13300 - DS_2021_HW1_LinkedList
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
| Case 6 |
1 sec |
32 MB |
Description
In this homework, we need to implement a draw card game.
- N people are playing card game, each of them has M cards.
- That is, player 1, 2, 3, ... , N.
- and card 1, 2, 3, ... , M of each player.
- We know that there exist K < N joker cards in the deck.
- Initially, any one of them has at most one joker card in hand.
- If a player starts off with a Joker in his or her hand, it will be replaced as the first card.
- That is, if Player A has Joker in the beginning, A’s hand will be Joker, 2, 3, ... , M
- Otherwise, card 1, 2, 3, ... , M.
- Each player draws the next player’s hand in order.
- That is, player 1 draws player 2’s card.
- Player 2 draws player 3’s card.
- Player N draws player 1’s card.
- In each round, we will have two input numbers .
- Player A draws the ith card from B’s hand, and places it as the jth card.
- If player B has only t < i cards, then A draws the last card.
- If player A has only t < j cards, then A places it as the last card.
- If i == -1 and j == -1, then stop the game.
- Among all the players who does not have Joker in their hands, print the cards (in ascending order) of the player with the smallest index.
- If this player has no card, then print "\n".
- Every card is followed by a blank character and a newline character in the end of card.
Input
There are 3 numbers in first line, denoted as N, M, K, respectively.
The next line has K numbers, denoting the index of person who has joker in the beginning.
In the remaining lines, players draw the next player’s hand in order.
- 2 ≤ N ≤ 100
- 1 ≤ M ≤ 1,000
- 1 ≤ K ≤ N-1
- 1 ≤ Remaining lines ≤ 1,000,000
Output
Among all the players who does not have Joker in their hands, print the cards (in ascending order) of the player with the smallest index.
- If player has no card, then print "\n".
- Every card is followed by a blank character and a newline character in the end of card.
Tags