COCI '06 Contest 4 #4 Zbrka

View as PDF

Submit solution

Points: 12 (partial)
Time limit: 1.0s
Memory limit: 64M

Problem type

Consider a sequence of N integers where each integer between 1 and N appears exactly once.

A pair of numbers in the sequence is confused if the number that comes earlier in the sequence is larger than the later number.

The confusion of the sequence is the number of confused pairs in it. For example, the confusion of the sequence (1, 4, 3, 2) is 3 because there are 3 confused pairs: (4, 3), (4, 2) and (3, 2).

Write a program that calculates the number of sequences of length N whose confusion is exactly C.

Input Specification

The first and only line of input contains two integers, N (1 \le N \le 1\,000) and C (0 \le C \le 10\,000).

Output Specification

Output the number of sequences modulo 1\,000\,000\,007.

Sample Input 1

10 1

Sample Output 1

9

Sample Input 2

4 3

Sample Output 2

6

Sample Input 3

9 13

Sample Output 3

17957

Comments

There are no comments at the moment.