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.

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.