there are n starfishes, there are m tentacles(触角), and there are k starfish species. Different kind of starfishes has a different number of tentacles.The same kind of starfishes have the same number of tentacles. Find the number of each kind of starfishes. If there are multiple solutions, the starfish with fewer tentacles has higher value. Find the most valuable solution. If there is no solution, output -1
输入描述:
There are a total of T (T<=10) groups of data
The first line of each group of data is n(n<=40), m(m<=2^31-1), k(k<=4),they represent n starfishes, m starfish tentacles and k starfish species
The second line is the number of tentacles of each kind of starfishes,the i-th number represents the number of tentacles of the i-th kind of starfishes(在第i种海星中,一只海星的角数)
输出描述:
For each set of data output the most valuable solution, if there is no solution, output -1
The last line outputs the number of successfully solved groups
示例1
输入
复制
9
31 113 2
2 4
31 68 2
2 4
34 104 2
2 4
38 94 2
2 4
36 121 2
2 4
32 117 2
2 4
33 122 2
2 4
34 100 2
2 4
35 57 2
2 4
输出
复制
-1
28 3
16 18
29 9
-1
-1
5 28
18 16
-1
5
示例2
输入
复制
2
36 82 4
2 3 4 5
35 58 4
2 3 4 5
备注:
The data guarantee that each starfish has five tentacles at most, and the number of tentacles for each kind of starfishes is different
from small to large input the number of tentacles of each kind of starfishes