Rectangle_Area

In Progress Posted 4 years ago Paid on delivery
In Progress Paid on delivery

The task

A 2D array of 0's and 1's is given. The array was filed with a sequence of correctly drawn rectangles of various sizes on different positions. Count the number of the remaining correctly drawn rectangles in the array and calculate the total area of their interiors.

Input

The first input line contains two integer M and N separated by space and specifying the number of rows and the number of columns in a 2D array which is on the next M lines. Each of next M lines contains N values which specify the contents of a row in the array, the values are separated by spaces. Each value is 0 or 1.

It holds 5 ≤ M, N ≤ 1000.

Output

The output contains one text line with two integers separated by space. The first integer represents the number of correctly drawn rectangles in the input array. The second line represents the sum of areas of interiors of all correctly drawn retangles in the input array.

Machine Learning (ML) Python Algorithm

Project ID: #20087201

About the project

1 proposal Remote project Active 4 years ago