#A. 排序任务

    Type: RemoteJudge 1000ms 125MiB

排序任务

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

假设我们将序列中第 ii 件物品的参数定义为 AiA_i,那么排序就是指将 A1,,AnA_1, \cdots ,A_n 从小到大排序。若 i<ji<jAi>AjA_i>A_j ,则 (i,j)(i,j) 就为一个“逆序对”。SORT 公司是一个专门为用户提供排序服务的公司,他们的收费标准就是被要求排序物品的“逆序对”的个数,简称“逆序数”。

Grant 是这家公司的排序员,他想知道对于 nn 个参数都不同的物品组成的序列集合中,逆序对数为 tt 的物品有多少个,并试给出其中一个最小的物品序列。所谓最小,即若有两个物品序列 (A1,A2,,An)(A_1,A_2,\cdots ,A_n)(B1,B2,,Bn)(B_1,B_2,\cdots ,B_n),存在 1in1 \le i \le n,使得 (A1,A2,,Ai1)=(B1,B2,,Bi1)(A_1,A_2,\cdots ,A_{i-1})=(B_1,B_2,\cdots,B_{i-1})Ai<BiA_i<B_i

输入格式

即两个整数 nnt(1n20,0tn(n1)2)t(1 \le n \le 20,0 \le t \le \dfrac{n\cdot (n-1)}{2})

输出格式

第一行表示 nn 个参数都不通的物品组成的序列集合中,逆序数为 tt 的序列个数;

第二行是所求物品参数序列。假设 nn 个物品分别为 11nn

4 3
6
1 4 3 2

1.4序列专项练习

Not Attended
Status
Done
Rule
IOI
Problem
4
Start at
2024-1-4 13:00
End at
2024-1-4 17:30
Duration
4.5 hour(s)
Host
Partic.
6