Problem1579--Finding the minimum value in a 2D array

1579: Finding the minimum value in a 2D array

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 1  Solved: 1
[Submit] [Status] [Web Board] [Creator:]

Description

Given 81 natural numbers or zeros written on a 9×9 grid as shown in the figure below, write a program to find the minimum value among them and determine which row and column that minimum value is located in.
For example, given 81 numbers as follows, the minimum value among them is 1, and this value is located at row 5 and column 9.
('열' means column, '행' means row.)


Input

Nine numbers are given on each line from the first to the ninth line. The given numbers are natural numbers less than 100 or 0.

Output

Print the minimum value on the first line, and on the second line, print the row and column numbers where the minimum value is located, separated by a space.
If there are two or more minimum values, print the one with the larger row value first; however, if the row values are the same, print the location of the one with the larger column value.

Sample Input Copy

3 23 85 34 17 74 25 52 65
10 7 39 42 88 52 14 72 63
87 42 18 78 53 45 18 84 53
34 28 64 85 12 16 75 36 55
21 77 45 35 28 75 90 76 1
25 87 65 15 28 11 37 28 74
65 27 75 41 7 89 78 64 39
47 47 70 45 23 65 3 41 44
87 13 82 38 31 12 29 29 80

Sample Output Copy

1
5 9

Source/Category