Even sum in a matrix
Practice
2.9 (16 votes)
Math basic
Bitmask
Basic programming
Bit manipulation
Basics of bit manipulation
Bit manipulation
Math
Problem
85% Success 2821 Attempts 30 Points 2.5s Time Limit 256MB Memory 1024 KB Max Code

You are given a matrix \(A\) containing \(N \times M\) elements. You are required to find the number of rectangular submatrices of this matrix such that the sum of the elements in each such submatrix is even.

Input format

  • The first line of input given two numbers \(N\ and\ M\) denoting the dimensions of the matrix.
  • The next \(N\) lines contain space-separated \(M\) numbers.

Output format

Print a number denoting the number of rectangular submatrices, the sum of the elements of each is even.

Constraints

\(1≤N,M≤2000\)

\(1≤A_i,_j≤10^9\)\(1≤i≤N,1≤j≤M\)

 

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:30
3 votes
Tags:
Basic ProgrammingBit ManipulationBit manipulationEasyLogic-BasedString Manipulation
Points:30
33 votes
Tags:
Basic ProgrammingBit ManipulationBit manipulationMediumObservation
Points:30
6 votes
Tags:
Bit ManipulationBasics of Bit ManipulationBasic ProgrammingObservationMathImplementation