#P7774. [COCI 2009/2010 #2] KUTEVI
[COCI 2009/2010 #2] KUTEVI
Background
This problem is from $\texttt{COCI 2009-2010}\ 2^\texttt{nd}\ \texttt{round}\ \text{T3 KUTEVI}$.
The score settings follow the original problem, with a full score of .
Problem Description
You are given angles (the -th angle is denoted as ) as initial angles, and also given angles (the -th angle is denoted as ) as target angles.
For each , determine whether it can be obtained by performing addition and subtraction among some of the .
Note that the same can be used multiple times, or not used at all.
Input Format
The first line contains two positive integers .
The second line contains positive integers, where the -th number is .
The third line contains positive integers, where the -th number is .
Output Format
Output lines. On the -th line, if can be obtained by performing addition and subtraction among some of the , output YES; otherwise output NO.
2 1
30 70
40
YES
1 1
100
60
YES
3 2
10 20 30
5 70
NO
YES
Hint
Sample Explanation
Explanation for sample :
.
Explanation for sample :
.
Constraints and Notes
, .
Translated by ChatGPT 5