Shil and Beautiful Matrix
Practice
4.1 (42 votes)
Combinatorics
Ad Hoc
Easy
Mathematics
Open
Approved
Problem
25% Success 2437 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

During his interview, Shil came across a very difficult problem. The problem is as follows:

A matrix V consisting of N rows and M columns is called beautiful if and only if it satisfies the following two conditions:

1) Every cell of the matrix contains distinct natural number less or equal to N*M.
2) For any two cells of the matrix, (i1,j1) and (i2,j2), if (i1^j1) > (i2^j2) then v[i1][j1] > v[i2][j2] .

^ denotes Bitwise XOR operation.

Note that 1 ≤ i1,i2 ≤ N and 1 ≤ j1,j2 ≤ M.

Given N and M , you have to calculatethe total number of beautiful matrices of size N x M. Since, problem is being very difficult for Shil to solve, he asks for your help.

Input format:
The Input consists of two integers N and M representing the number of rows and columns respectively.

Output format:
Output the total number of Beautiful Matrices of size N x M. Since, this answer can be large, output it modulo 109+7

Constraints:
1 ≤ N,M ≤ 1000

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
4 votes
Tags:
MathC++ObservationBasic Math
Points:20
24 votes
Tags:
Ad-HocBasic ProgrammingEasyMathematicsOpenApprovedMathamatics
Points:20
42 votes
Tags:
ReadyBasic ProgrammingOpenEasyMathamatics