CF246C.Beauty Pageant

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

General Payne has a battalion of nn soldiers. The soldiers' beauty contest is coming up, it will last for kk days. Payne decided that his battalion will participate in the pageant. Now he has choose the participants.

All soldiers in the battalion have different beauty that is represented by a positive integer. The value aia_{i} represents the beauty of the ii -th soldier.

On each of kk days Generals has to send a detachment of soldiers to the pageant. The beauty of the detachment is the sum of the beauties of the soldiers, who are part of this detachment. Payne wants to surprise the jury of the beauty pageant, so each of kk days the beauty of the sent detachment should be unique. In other words, all kk beauties of the sent detachments must be distinct numbers.

Help Payne choose kk detachments of different beauties for the pageant. Please note that Payne cannot just forget to send soldiers on one day, that is, the detachment of soldiers he sends to the pageant should never be empty.

输入格式

The first line contains two integers nn , kk ( 1<=n<=501<=n<=50 ; 1<=k<=1<=k<= ) — the number of soldiers and the number of days in the pageant, correspondingly. The second line contains space-separated integers a1,a2,...,ana_{1},a_{2},...,a_{n} (1<=ai<=107)(1<=a_{i}<=10^{7}) — the beauties of the battalion soldiers.

It is guaranteed that Payne's battalion doesn't have two soldiers with the same beauty.

输出格式

Print kk lines: in the ii -th line print the description of the detachment that will participate in the pageant on the ii -th day. The description consists of integer cic_{i} (1<=ci<=n)(1<=c_{i}<=n) — the number of soldiers in the detachment on the ii -th day of the pageant and cic_{i} distinct integers p1,i,p2,i,...,pci,ip_{1,i},p_{2,i},...,p_{ci},i — the beauties of the soldiers in the detachment on the ii -th day of the pageant. The beauties of the soldiers are allowed to print in any order.

Separate numbers on the lines by spaces. It is guaranteed that there is the solution that meets the problem conditions. If there are multiple solutions, print any of them.

输入输出样例

  • 输入#1

    3 3
    1 2 3
    

    输出#1

    1 1
    1 2
    2 3 2
    
  • 输入#2

    2 1
    7 12
    

    输出#2

    1 12 
    
首页