#P13659. [CERC 2020] Storage Problems

[CERC 2020] Storage Problems

题目描述

The gangsters did a very successful robbery of the city's most famous auction house. Now they are safely at their hideout, where they store the stolen items. Luckily, you managed to place a listening device into their hideout. You also have a personal file on each ganger, which contains a recording of their voice. You will listen carefully to what happens next with hope it will help you with the investigation of the robbery.

Each gangster stole exactly one item, the ii-th gangster stole the ii-th item. Now each gangster is trying to put his item into the common storage, which can hold a total weight of KK. The storage is a small room and the gangsters store their items one by one.

When a gangster tries to put an item into the storage but it does not fit, that is the total weight of the items in the storage would exceed KK, he gets angry and throws all the items in the storage out. While doing this, he tells the others that "jj items are going to trash!", where jj is the number of items in the storage at the point he tried to store his item. At this point a fight ensues and no more storing will happen.

As you have a listening device in the gangsters' storage, you will hear how much items the gangster throws out. Also, using your personal files, you can tell apart each of the gangster's voices.

Therefore, it would help your investigation greatly if you could know in advance, for all possible values of jj and ii, how many different subsets of items could be in the storage at the moment when the ii-th gangster throws all the jj items out. As the number of subsets can be large, output it modulo 167772161167772161.

输入格式

The input consists of two lines. The first line contains two integers NN and KK (2N4002 \leq N \leq 400, 1K4001 \leq K \leq 400), the number of gangsters and the maximum weight that the storage can hold. The second line contains NN integers w1,w2,,wNw_1, w_2, \cdots, w_N, such that (1wiK1 \leq w_i \leq K) for each 1iN1 \leq i \leq N. Here wiw_i is the weight of item that the ii-th gangster stole.

输出格式

The output consists of NN lines, each line containing exactly N1N-1 integers. The jj-th value on the ii-th line contains the number of subsets of items containing exactly jj items, such that they fit into the storage but the ii-th gangster's item can not be added. Each number is modulo 167772161167772161.

3 3
2 2 1
1 1
1 1
0 0
5 5
1 2 3 4 5
1 1 0 0
2 2 0 0
2 2 0 0
3 3 0 0
4 4 0 0