#C11509. Find Missing Serial Numbers

    ID: 40833 Type: Default 1000ms 256MiB

Find Missing Serial Numbers

Find Missing Serial Numbers

You are given several batches of serial numbers. In each batch, the serial numbers are sorted in increasing order. Your task is to find the missing serial numbers in the range defined by the first and last number of each batch. Formally, for a given batch with serial numbers (a_1, a_2, \dots, a_m) where (a_1 < a_2 < \cdots < a_m), you need to find all numbers (x) such that (a_1 \le x \le a_m) and (x \notin {a_1, a_2, \dots, a_m}). If no numbers are missing in the interval, print "None".

Example:
For a batch [1, 2, 3, 5], the missing serial number is 4 because (1 \le x \le 5) and 4 is not in the list. For a batch [100, 101, 102, 103, 104], no numbers are missing so the answer is "None".

inputFormat

The input is read from standard input (stdin). The first line contains a single integer (T) representing the number of batches. Each of the following (T) lines describes a batch in the following format:

m a1 a2 ... am

where (m) is the number of serial numbers in the batch, followed by (m) sorted integers representing the serial numbers.

outputFormat

For each batch, print the missing serial numbers in increasing order separated by a single space on a new line. If there are no missing numbers within the range defined by the first and last serial number, print "None".## sample

3
4 1 2 3 5
5 10 11 12 14 15
2 20 22
4

13 21

</p>