시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 38 | 14 | 13 | 46.429% |
A sequence x1, x2, ..., xn of different integers is called a permutation of size n if 1 ≤ xi ≤ n for every 1 ≤ i ≤ n. For every permutation we define its inversions as pairs of indices 1 ≤ i < j ≤ n such that xi > xj. Your task is to count the number of permutations of size n, having a given number of inversions.
Write a program which:
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.
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.
3 2
2
The permutations of size 3 which have 2 inversions are 2, 3, 1 and 3, 1, 2.
Contest > Algorithmic Engagements > PA 2007 7-3번