QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 8 MB Total points: 100

#11851. Inversions

統計

A sequence $ x_{1}, x_{2}, \ldots, x_{n} $ of different integers is called a permutation of size $ n $ if $1 ≤ x_{i} ≤ n $ for every $1 ≤ i ≤ n $. For every permutation we define its inversions as pairs of indices $1 ≤ i < j ≤ n $ such that $ x_{i} > x_{j} $. Your task is to count the number of permutations of size $ n $, having a given number of inversions.

Write a program which:

  • reads from the standard input the size of the permutation and the number of inversions,
  • counts the number of permutations of the given size and having the given number of inversions,
  • writes the result to the standard output.

Input Format

The first and only line of input contains two integers $ n $ and $ k $ ($1 ≤ n ≤ 500$, $0 ≤ k ≤ n(n - 1)/2$), separated by a single space and representing the size of permutation and the number of inversions we are interested in.

Output Format

The first and only line of output should contain the remainder of the division of the number of the permutations we are interested in by 30 011.

Example

Input

3 2

Output

2

Notes

The permutations of size 3 which have 2 inversions are 2, 3, 1 and 3, 1, 2.

Discussions

About Discussions

The discussion section is only for posting: Editorials, 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. Submitting multiple issues may cause your account to be banned.
  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.