Wonderful Table
Limits: 5 sec., 512 MiB
This statement was translated automatically from Ukrainian.
Zenyk and Marichka wrote a rectangular table of numbers with \(n\) rows and \(m\) columns on a piece of paper. They understand that the table is wonderful, but they don’t yet know how wonderful it is.
Let’s define the wonderfulness of a table as the number of rows that form a non-decreasing sequence (a sequence in which, for every pair of adjacent elements, the right-hand element is greater than or equal to the left-hand one).
Zenyk and Marichka can arbitrarily rearrange the numbers in each column of their table. For each possible wonderfulness of the table from 0 to \(n\), you need to determine how many different tables with such wonderfulness can be obtained. Two tables are considered different if at least one corresponding cell contains different numbers. Since the quantities can be very large, output the remainder of the division of each quantity by \(10^9 + 7\).
Input
The first line contains two integers \(n\) and \(m\) separated by a space — the number of rows and columns of the table, respectively.
The next \(n\) lines contain \(m\) integers each separated by spaces — the numbers \(a_{ij}\) written in the corresponding row of the table.
Output
In a single line, output \(n + 1\) integers — the remainders of the division of the number of tables with wonderfulness from 0 to \(n\) by \(10^9 + 7\).
Constraints
\(2 \le n \le 11\),
\(2 \le m \le 74\),
\(1 \le a_{ij} \le 10^9\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 2 2 2 3 4 1 | 2 2 0 |
| Input (stdin) | Output (stdout) |
|---|---|
| 2 3 2 2 2 1 1 1 | 2 4 2 |
| Input (stdin) | Output (stdout) |
|---|---|
| 7 7 1 2 3 4 5 6 7 2 3 4 5 6 7 8 3 4 5 6 7 8 9 4 5 6 7 8 9 10 5 6 7 8 9 10 11 6 7 8 9 10 11 12 7 8 9 10 11 12 13 | 597343665 499352224 549786821 455372899 462125500 581920343 804163015 160325018 |
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|