407484: GYM102801 L PepperLa's Express
Description
PepperLa's City is a three-dimensional city whose size is $$$(Z*X*Y)$$$.
PepperLa Express is the only express in the city. The company has set up several delivery station in the city, and users will choose the nearest one.
PepperLa's vehicle is poor, it can only travel along the $$$Z, X, Y$$$ axis at the speed of one unit length per day.
Because many users complained about the delivery inefficiency, PepperLa decides to add a new delivery station in the open space. According to "barrel principle" PepperLa hopes to reduce the maximum delivery time. It means to minimize the maximum delivery time of all users.
Could You help him find the best place?
InputThere are multiple test cases in this problem.
For every test case, The first line has 3 interger, $$$Z,X,Y(1 \leq Z,X,Y \leq 10^2)$$$
Then following $$$Z\times X$$$ lines each line contains $$$Y$$$ characters, the character in $$$i$$$'th row (start from 0), $$$j$$$'th column is $$$(z=\lfloor i/X \rfloor+1,x=i\%X+1, y=j)$$$
'.' represents open space, '*' represents a user, '@' represents a delivery station.
The input guarantees that there is at least one '.' and at least one '@'. $$$\sum{Z\times X \times Y}\leq 6 \times 10^6$$$
OutputFor each test case, output a single line contains one integer,representing for the minimal delivery time.
ExampleInput3 3 3 ... .*. ... @*@ *.* @*@ ... .*. ...Output
1Note
the best place to set up a new delivery station is $$$(z=2,x=2,y=2)$$$