8501: Divide the Sweets

内存限制:128 MB 时间限制:16 S
题面:传统 评测方式:文本比较 上传者:
提交:2 通过:1

题目描述

To celebrate Children's Day, a mother of k kids comes to the shop to buy sweets. There are n boxes of sweets in the shop, the i-th box has wi sweets. The mother will choose which boxes to buy, and will divide all the bought boxes among the k kids. Each kid will receive several (maybe zero) boxes, and will count the total number of sweets he receives. Assume the i-th kid receives ci  sweets, the unfairness is defined as i=1kci2. To make all the kids happy, the mother will always divide boxes to minimize the unfairness. Note that she can not open any box to adjust the number of sweets inside it.

The mother is wondering which boxes to buy. She can not make her final decision. Please write a program to help the mother try all possible 2^n-1 non-empty subsets of boxes to buy, and figure out the minimum unfairness for each subset. Note that you only need to report the sum of the minimum unfairness among all 2^n-1 non-empty subsets.

输入格式

The first line contains a single integer T(1T50), the number of test cases. For each test case:

The first line contains two integers nand m(1mn20n+m23), denoting the number of boxes and the parameter mm.

The second line contains n integers w1,w2,,wn (1wi50,000), denoting the number of sweets in each box.

It is guaranteed that there are at most 2 cases such that n>12.

输出格式

For each test case, output mm lines, the i-th (1im) of which containing an integer, denoting the answer when k=i Note that the answer may be extremely large, so please print it modulo 998,244,353 instead.

输入样例 复制

1
5 4
1 2 3 4 5

输出样例 复制

2240
1180
930
884