|
Example:
- Input
The first line consists of a single integer number denoting n, the length of the table
side. Then, is successive lines the rows are given containing the integer numbers
separated by one space, e.g.
6
19 19 12 12 12 19
19 12 7 12 12 7
2 4 7 7 12 19
19 12 12 12 12 19
19 19 19 19 5 19
30 6 30 5 12 19
- Output:
- After replacing x with y, the output should be as follows:
5 5 4 4 4 5
5 4 3 4 4 3
1 2 3 3 4 5
5 4 4 4 4 5
5 5 5 5 2 5
6 2 6 2 4 5
- The output should be given in three separate lines as follows:
11
4
(1,2),(4,5)
where the first line gives the maximal number of y connected elements, the second line
contains the y value, and the third line contains the coordinates of the enclosing
rectangle.
HINT:you may avoid the parentheses and give the coordinates separated by commas.
The same hint holds for the output of question (iv) and (v).
- The output consists of a single number:
8
which stands for the minimum number of non-overlapping square in the area of (ii).
- The output should be as follows:
1
(5,5),(6,5)
5 5 4 4 4 5
5 4 3 4 4 3
1 2 3 3 4 5
5 4 4 4 4 5
5 5 5 5 4 5
6 2 6 2 2 5
where the first line gives the minimum number of swappings, and the second line gives the
coordinates of the swapped element(s). The next n lines contain the new form of the table.
- The output should be as follows:
5
2
(1,2),(3,1)
(1,6),(5,5)
5 1 4 4 4 2
5 4 3 4 4 3
5 2 3 3 4 5
5 4 4 4 4 5
5 5 5 5 5 5
6 2 6 2 4 5
where the first line stands for the most often appearing element, the second line for the
minimum number of swappings, the next lines give the coordinates of the two swappings.
Finally, the last n lines illustrate the new form of the table .
|