Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Mr. Zero

By sagarthecoder · Limits 1s, 512 MB

Mr. Zero has a matrix Z consisting of m rows and n columns. The rows are numbered from 1 to m, columns are numbered from 1 to n. Element at row i (1 ≤ i ≤ m) and column j (1 ≤ j ≤ n) is denoted as Zij. All elements of Z are either 0 or 1.

Mr. Zero gives you a task. You need to calculate how many positions are in the matrix Z where all elements of ith row and jth column contain 0.


The first line contains two integer m and n (1 ≤ m, n ≤ 1000), number of rows and number of columns of matrices respectively.
The next m lines each contain n integers separated by spaces describing rows of matrix Z (each element of Z is either 0 or 1).


In the first line, print the desired output.


3 3
1 0 0
0 0 0
1 0 0

In the sample case:
All elements of second row and second column contain 0.
All elements of second row and third column contain 0.



0% Solution Ratio


Login to submit

Related Contests

SEC Intra Campus Programming Contest, CSE Fest 2020 Ended at 2020-02-19 11:02:00 +0000 UTC