{"trustable":true,"sections":[{"title":"","value":{"format":"HTML","content":"People in the hidden region of the Bermuda Triangle make everything they need in triangular shapes. One day, someone decided to break the rule and bake a hexagonally shaped cake. But as usual, he has to serve the cake in triangular pieces. The pieces are equilateral triangles but in different sizes for different people. He can use as many triangles as needed to cut the cake into pieces, such that nothing remains from the cake. For example, the following figure shows one way that a hexagon with side 9 can be cut into triangles with side 2 and 3. (The cake is cut along the thick lines, thin lines are drawn to show the sizes).\r\u003cbr\u003e\u003ccenter\u003e\u003cimg src\u003d\"CDN_BASE_URL/bad06f0d204e08e5ec01c2ebf5fea9d4?v\u003d1714560474\"\u003e\u003c/center\u003e\r\u003cbr\u003eInput is a hexagon and triangle types (specified by the length of their sides) and the goal is to decide if the hexagon can be completely divided by the given triangle types."}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input file contains a single integer t (1 \u0026lt;\u003d t \u0026lt;\u003d 10), the number of test cases, followed by the input data for each test case. Each test case consists of a single line, containing s (1 \u0026lt;\u003d s \u0026lt;\u003d 25), the length of the hexagon\u0027s side, followed by n, the number of triangle types (1 \u0026lt;\u003d n \u0026lt;\u003d 10), followed by n integers representing the length of each triangle type\u0027s side (between 1 and 25, inclusive)."}},{"title":"Output","value":{"format":"HTML","content":"There should be one output line per test case containing either YES or NO depending on whether the hexagon can be completely divided by the given triangle types."}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e3\r\n5 2 2 3\r\n7 2 3 2\r\n13 2 2 3\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eNO\r\nNO\r\nYES\r\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}