#K95562. Find Unique Species IDs Observed on Only One Day
Find Unique Species IDs Observed on Only One Day
Find Unique Species IDs Observed on Only One Day
You are given the species IDs of animals observed on two consecutive days. Your task is to find out which species were observed exclusively on one of the two days. In other words, you need to compute the symmetric difference between the two sets of species IDs.
Mathematically, if A is the set of species from day one and B is the set from day two, you are to compute:
$$\text{UniqueSpecies} = (A \cup B) \setminus (A \cap B) $$After computing the unique species, output their IDs sorted in ascending order, separated by a single space. If there are no unique species, output an empty line.
inputFormat
The input is read from standard input (stdin) and has the following format:
- The first line contains a single integer T — the number of test cases.
- For each test case:
- The first line contains two integers N and M — the number of species IDs observed on day one and day two respectively.
- The second line contains N space-separated integers representing the species IDs observed on day one.
- The third line contains M space-separated integers representing the species IDs observed on day two.
outputFormat
For each test case, output a single line (to standard output, stdout) containing the unique species IDs sorted in ascending order, separated by a space. If there are no unique species, output an empty line.
## sample5
6 5
10 20 30 40 50 60
20 30 70 80 90
5 5
1 2 3 4 5
4 5 6 7 8
3 3
10 11 12
13 14 10
3 3
1 2 3
4 5 6
4 4
1 2 3 4
1 2 3 4
10 40 50 60 70 80 90
1 2 3 6 7 8
11 12 13 14
1 2 3 4 5 6
</p>