Additive Combinatorics
题号:NC295120
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

Recently, Colin became addicted to the theory of additive combinatorics, which is about counting additive structures in sets. This theory has seen exciting developments and dramatic changes in direction in recent years, thanks to its connections with areas such as number theory, ergodic theory, and graph theory.

One fundamental problem in additive combinatorics is about sumsets. For two sets of integers A,B, we define the sumset of A and B to be the set of all sums of an element from A with an element from B. That is,

A+B=\{a+b:a\in A, b\in B\}

Now Colin gives you three sets A,B,C; could you determine whether C is the sumset of A and B?

输入描述:

The first line contains three integers n_1,n_2,n_3~(1\le n_1,n_2\le 10^3,1\le n_3\le 10^6), representing the size of A, B, and C.

The second line contains n_1 integers a_1,a_2,\cdots,a_{n_1}~(1\le a_i\le 10^9), representing the numbers in A.

The third line contains n_2 integers b_1,b_2,\cdots,b_{n_2}~(1\le b_i\le 10^9), representing the numbers in B.

The fourth line contains n_3 integers c_1,c_2,\cdots,c_{n_3}~(1\le c_i\le 2\times 10^9), representing the numbers in C.

It's guaranteed that numbers in the same set are pairwise distinct.

输出描述:

If C is the sumset of A and B, output YES. Otherwise, output NO.
示例1

输入

复制
2 2 3
1 2
2 1
3 4 2

输出

复制
YES
示例2

输入

复制
2 2 2
1 2
1 2
2 3

输出

复制
NO
示例3

输入

复制
2 2 4
1 2
1 2
1 2 3 4

输出

复制
NO