QOJ.ac

QOJ

実行時間制限: 1 s メモリ制限: 8 MB 満点: 100

#11851. 逆序对

統計

一个由不同整数组成的序列 $x_{1}, x_{2}, \ldots, x_{n}$ 被称为大小为 $n$ 的排列,如果对于每个 $1 \le i \le n$,都有 $1 \le x_{i} \le n$。对于每个排列,我们将其逆序对定义为满足 $1 \le i < j \le n$ 且 $x_{i} > x_{j}$ 的索引对 $(i, j)$。你的任务是计算具有给定逆序对数量的大小为 $n$ 的排列个数。

编写一个程序:

  • 从标准输入读取排列的大小和逆序对的数量,
  • 计算具有给定大小且具有给定逆序对数量的排列个数,
  • 将结果写入标准输出。

输入格式

输入的第一行也是唯一一行包含两个整数 $n$ 和 $k$($1 \le n \le 500$,$0 \le k \le n(n - 1)/2$),由单个空格分隔,分别表示排列的大小和我们感兴趣的逆序对数量。

输出格式

输出的第一行也是唯一一行应包含我们感兴趣的排列个数除以 30 011 的余数。

样例

输入 1

3 2

输出 1

2

说明

大小为 3 且具有 2 个逆序对的排列为 2, 3, 1 和 3, 1, 2。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.