#abc344c. C - A+B+C

C - A+B+C

Score: 250250 points

问题陈述

你已给出三个序列 A=(A1,,AN)A=(A_1,\ldots,A_N)B=(B1,,BM)B=(B_1,\ldots,B_M)C=(C1,,CL)C=(C_1,\ldots,C_L)

另外,还给出一个序列 X=(X1,,XQ)X=(X_1,\ldots,X_Q)。对于每个 i=1,,Qi=1,\ldots,Q,解决以下问题:

问题:是否可以从 AABBCC 中各选择一个元素,使得它们的和等于 XiX_i

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

You are given three sequences A=(A1,,AN)A=(A_1,\ldots,A_N), B=(B1,,BM)B=(B_1,\ldots,B_M), and C=(C1,,CL)C=(C_1,\ldots,C_L).

Additionally, a sequence X=(X1,,XQ)X=(X_1,\ldots,X_Q) is given. For each i=1,,Qi=1,\ldots,Q, solve the following problem:

Problem: Is it possible to select one element from each of AA, BB, and CC so that their sum is XiX_i?

Constraints

  • 1N,M,L1001 \leq N,M,L \leq 100
  • 0Ai,Bi,Ci1080 \leq A_i, B_i ,C_i \leq 10^8
  • 1Q2×1051 \leq Q \leq 2\times 10^5
  • 0Xi3×1080 \leq X_i \leq 3\times 10^8
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN

A1A_1 \ldots ANA_N

MM

B1B_1 \ldots BMB_M

LL

C1C_1 \ldots CLC_L

QQ

X1X_1 \ldots XQX_Q

Output

Print QQ lines. The ii-th line should contain Yes if it is possible to select one element from each of AA, BB, and CC so that their sum is XiX_i, and No otherwise.

Sample Input 1

3
1 2 3
2
2 4
6
1 2 4 8 16 32
4
1 5 10 50

Sample Output 1

No
Yes
Yes
No
  • It is impossible to select one element from each of AA, BB, and CC so that their sum is 11.
  • Selecting 11, 22, and 22 from AA, BB, and CC, respectively, makes the sum 55.
  • Selecting 22, 44, and 44 from AA, BB, and CC, respectively, makes the sum 1010.
  • It is impossible to select one element from each of AA, BB, and CC so that their sum is 5050.
}