_______________________________________...
did anyone found the answer for Marathon Runner questions...?????
same xam writing. but no answer
hahaha..writing the same xam here!!
I DONT KNOW!!! :P
Bob had an exam the next day and had just sat to study. That's when he noticed that his naughty sister had torn pages from his textbook away. He searched the whole house and got a set of pages from each room. He listed the page numbers on each page that he found. Bob wants to know if there are any more pages still missing. Help Bob count the number of pages still missing.
Input
The first line contains an integer T. The number of test cases.
For each test case the first line contains the last page number N.
The second line contains the number of rooms R from which Bob collected the pages.
The following R lines contains an integer P followed by P integers.
Output
The total number of pages missing.Print the answer for each test case in a seperate line.
Constraints :
1<=T<=100
1<=N<=500
1<=R<=10
0<=P<= (N/2)
Each of the P integers will contain the page number on either side of the page.
It is guarnteed that each page will appear only once in each test case.
See the sample case for more explanation.
Sample Input
2
5
1
2 1 4
12
3
2 1 3
1 10
2 6 11
Sample Output
1
1
Explanation :
First Test Case: Page 1/2 and Page 3/4 were found. Page with page number 5 is missing.