GREED - Greedy island
Gon is on Greedy island. He wants to go home. But to get the ticket to leave the game, he has to get N cards labeled in a sequence from 1 to N (the order of the cards in his hand is irrelevant). He already has N cards, but not forming a sequence from 1 to N. So he wants you to help him. For some cards, he can change one card for another for one piece of gold. Help him to get the ticket at the minimum cost (using the minimum number of exchanges).
Input
The first line contains t, the number of tests (1<=t<=10). For each test case:
- the number of cards N is given is given in the first line (2<=N<=500).
- the next N lines contain the N cards owned by Gon.
- the following l