← 返回 amazon 的题目列表Maximum Greyness in Satellite Image Grid Cells
类型:online_judge
amazon
Several satellites provide observational black and white images that are stored in data centers at Amazon Web Services (AWS). These images are represented as a n * m grid of cells. Each pixel can have a value of 0 or 1, where 0 represents a black pixel and 1 represents a white pixel.
The greyness of a cell (i, j) is defined as the difference between the number of black pixels in the i-th row and the j-th column and the number of white pixels in the i-th row and the j-th column.
Find the maximum greyness among all the cells of the grid.
Example:
pixels = ["110", "001", "110"] The greyness of the cell (1, 1) is 2.
Return the maximum achievable greyness value.
Example
Input
3 3
110
001
110