#C8433. Merge Orb Sets
Merge Orb Sets
Merge Orb Sets
You are given t test cases. In each test case, you are provided with two sets of orbs represented by their integer values. Let the first set be \(S_1\) with \(n\) elements and the second set be \(S_2\) with \(m\) elements. Your task is to merge the two sets by computing the union \(S_1 \cup S_2\) and then remove any orb that appears in both sets (i.e. the intersection \(S_1 \cap S_2\)). In other words, the final set is given by:
[ \text{FinalSet} = (S_1 \cup S_2) \setminus (S_1 \cap S_2) ]
If the resulting set is empty, print Empty Set
. Otherwise, print the elements of the final set sorted in ascending order and separated by a single space.
inputFormat
The input is read from standard input (STDIN) and is structured as follows:
- The first line contains an integer
t
representing the number of test cases. - For each test case:
- The first line contains two integers
n
andm
denoting the number of elements in the first and second orb sets, respectively. - The second line contains
n
space-separated integers representing the elements of the first set. Ifn = 0
, this line will be empty. - The third line contains
m
space-separated integers representing the elements of the second set. Ifm = 0
, this line will be empty.
- The first line contains two integers
outputFormat
For each test case, output a single line to standard output (STDOUT) with the following:
- If the resulting set is not empty, print the sorted unique elements (after removing common elements) separated by a single space.
- If the resulting set is empty, print
Empty Set
.
3
3 3
1 2 3
3 4 5
4 3
10 20 30 40
5 10 15
2 2
100 200
200 300
1 2 4 5
5 15 20 30 40
100 300
</p>