Boredom Buster
문제
You are stuck alone in a cabin and it is raining outside. You are bored out of your mind and the only available boredom buster is a deck of Memory cards. Playing Memory by yourself is not very fun, but you developed a single player variant that requires not only good memory but also strategy.
It goes like this: You have a shuffled deck of cards, where is even and each card contains a number from to . There are exactly two cards of each number. The cards are laid face down on the table and your goal is to find what number is written on each of them. In one move, you pick up two cards. Before revealing them, you randomly shuffle them so that you do not know which card was where. Then you look at the two cards. After that, you shuffle them again face down before you put them back where they were. That way, you know the numbers of the two cards and where they are, but not which card ended up where, or even what card came from which spot initially.
Your task is to write a program that will beat this game.
예제
예제 1
6 3 2 2 3 1 1 3 3
? 2 1 ? 5 3 ? 6 4 ? 1 3 ! 3 2 3 1 2 1