Submit | All submissions | Best solutions | Back to list |
HS10EXRC - Get Stronger |
To shape his strength, Robert is doing weightlifting. His training set consists of n < 20 weight plates: x1, x2, ..., xn (1 ≤ xi ≤ 20}. Check, if he is able to compose a total weight of X with his training set.
Input data specification
First, an integer t < 500, describing the number of test cases. Next, for each of the test cases: X, n, and n integers.
Output data specification
For each of the test cases print one word: YES if Robert will be able to compose the required weight, or the word NO if this is impossible.
Example
Input: 4 5 3 2 1 3 18 3 11 10 9 5 4 1 2 1 6 23 5 11 1 2 10 18 Output: YES NO NO YES
Scoring
By solving this problem you score 10 points.
Added by: | kuszi |
Date: | 2011-03-25 |
Time limit: | 1s-2s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ADA95 ASM32 BASH BF C CSHARP C++ 4.3.2 CPP C99 CLPS CLOJURE LISP sbcl LISP clisp D ERL FSHARP FORTRAN GO HASK ICON ICK JAVA JS-RHINO LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PERL6 PHP PIKE PRLG-swi PYTHON PYTHON3 RUBY SCALA SCM guile SCM qobi ST TCL WHITESPACE |
Resource: | High School Programming League 2010/11 |