P27268 [AtCoder] Xor of Sequences
入门
题目描述

Problem Statement

We have two strictly increasing integer sequences $A = (A_1, A_2, \dots, A_N)$ and $B = (B_1, B_2, \dots, B_M)$.
Find all integers that appear in exactly one of A and B and print them in ascending order.

Input

Input is given from Standard Input in the following format:
N M
$A_1 A_2 \cdots A_N$
$B_1 B_2 \cdots B_M$

Output

Print all integers that appear in exactly one of A and B in ascending order, with space as separator.

Constraints

  • All values in input are integers.
  • $1 \leq N, M \leq 10^3$
  • $1 \leq A_1 < A_2 < \dots < A_N \leq 10^3$
  • $1 \leq B_1 < B_2 < \dots < B_M \leq 10^3$

Sample Input 1

2 2
1 2
1 3

Sample Output 1

2 3

1 is contained in both A and B;
2 is contained in only A;
3 is contained in only B.
Thus, we should print 2 and 3.

Sample Input 2

4 4
1 2 3 4
1 2 3 4

Sample Output 2

You can print an empty line or nothing.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 2 1 2 1 3
样例输出
2 3