Given an m ✕ n matrix A, please calculate the 2x2 max-pooling of A.
Both m and n are multiples of 2.
The computation of 2x2 max-pooling is to find the maximum for each 2x2 block of A.
For example, if A is
1 2 3 4 5 6
6 5 4 3 2 1
9 8 7 6 5 4
4 5 6 7 8 9
the output should be
6 4 6
9 7 9
because they are the maximal values of the partitions:
1 2|3 4|5 6
6 5|4 3|2 1
---+---+---
9 8|7 6|5 4
4 5|6 7|8 9
Note: The is a partial judge problem. We have already handled the input and output for you. All you have to do is to implement the function "max_pooling":
void max_pooling(int A[500][500], int *m, int *n);
The first line contains two integers m, n, representing the dimensions of A.
The next m lines contain n integers a_ij, j=1,...n, as the entries of the mth row of A.
It is guaranteed that
1 ≤ m, n ≤ 500
We have already handled the input for you.
Please print the result of 2x2 max-pooling.
We have already handled the output for you.