시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
2 초 | 512 MB | 38 | 18 | 18 | 47.368% |
This week you started a flashy new job in Leeds as a poker dealer. Your task will be to hand out the cards for games. The base pay is not particularly good, but you found out that you can earn a lot from tips if you deal the cards well.
The most generous customers prefer that their opponents at the table don’t receive any pairs of cards with the same number; so to keep them happy you will make sure this never happens.
You already know the numbers on every card in the pile , and the number of cards any player must have in their hand. Find how many hands you can make at once without introducing a pair.
Figure C.1: Illustration of a solution to Sample Input 2.
The input consists of:
If it is not possible to make any hands at all without introducing a pair, output impossible.
Otherwise, output k lines (where k is the maximum possible number of players) each containing h numbers from the input. You may not use any number any more times than it appears in v.
If there are multiple answers with a maximum value of k, you may output any one of them.
6 3 1 2 1 2 3 4
1 2 4 1 2 3
14 3 3 4 1 1 1 2 3 1 2 1 1 5 6 7
6 1 3 2 4 1 5 1 2 1 3 7
8 5 1 1 2 2 3 3 4 4
impossible
ICPC > Regionals > Europe > Northwestern European Regional Contest > The UK & Ireland Programming Contest > UKIEPC 2019 C번