Description

Given n x m matrix initialized with zeros and indices of rows and columns to increment, return the number of cells with odd values after applying all increments.

Examples

Input:m = 2, n = 3, indices = [[0,1],[1,1]]
Output:6
Explanation:

After operations, 6 cells have odd values.

Input:m = 2, n = 2, indices = [[1,1],[0,0]]
Output:0
Explanation:

Each row and column is incremented exactly once, so all cells end up with value 2 (even). No cells have odd values.

Input:m = 3, n = 1, indices = [[0,0],[1,0],[2,0]]
Output:0
Explanation:

Starting with a 3×1 matrix of zeros. Each operation increments row i and column 0. After [0,0]: row 0 becomes [2], column 0 gets +1. After [1,0]: row 1 becomes [2], column 0 gets +1. After [2,0]: row 2 becomes [2], column 0 gets +1. Final matrix: [[4],[4],[4]]. All values are even, so 0 cells have odd values.

Constraints

  • 1 ≤ m, n ≤ 50

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!