Answered step by step
Verified Expert Solution
Question
00
1 Approved Answer
Lana likes to draw specific snowflakes. A snowflake of size is defined as follows: The center of the snowflake is the character + . Above
Lana likes to draw specific snowflakes. A snowflake of size is defined as follows: The center of the snowflake is the character Above and below the character there is a sequence of characters To the left and right of the character there is a sequence of characters On the diagonal from the upper left corner to the center and from the center to the lower right corner of the snowflake, there is a sequence of characters On the diagonal from the upper right corner to the center and from the center to the lower left corner of the snowflake, there is a sequence of characters Sometimes Lana connects several snowflakes, but even then the size of each snowflake is determined separately, regardless of whether the snowflakes share some characters. On the left is an example of a snowflake of size In the middle is an example of connected snowflakes, the left one of size and the right one of size On the right is an example of a snowflake of size It is missing one character to be of size Lana is currently drawing snowflakes on a piece of paper of size draw all the snowflakes completely in accordance with her usual snowflake shapes. Namely, some snowflakes are missing some characters, so their size is equal to the smallest length of the corresponding character sequence from the center in one of the eight directions. Moreover, she drew some characters that are not part of any snowflake. Can you help Lana determine the size of the largest snowflake in the drawing? However, she got a bit confused and did not mtimes n x x x x x Input Specification The first line contains two integers and the size of the drawing. In each of the following lines there are characters describing the drawing. The characters that can appear in the drawing are and The ASCII values of these characters are and respectively. Output Specification In the first and only line, you should output the size of the largest snowflake in the drawing. Constraints Subtask Points Constraints There won't be any snowflake, or the largest snowflake will be of size There will be at most one character in the drawing. No additional constraints. Sample Input Sample Output Explanation for Sample Only one snowflake is drawn. mn m n m n In the directions upleft, up and upright from the center of the snowflake, there are sequences of length In the directions right and downright from the center of the snowflake, there are sequences of length In the directions left, downleft and down from the center of the snowflake, there are sequences of length Therefore, the size of the snowflake is Sample Input Sample Output Explanation for Sample Two connected snowflakes are drawn, the left one of size and the right one of size Sample Input Sample Output
Lana likes to draw specific snowflakes. A snowflake of size is defined as follows:
The center of the snowflake is the character
Above and below the character there is a sequence of characters To the left and right of the character there is a sequence of characters
On the diagonal from the upper left corner to the center and from the center to the lower right corner of the snowflake, there is a sequence of characters On the diagonal from the upper right corner to the center and from the center to the lower left corner of the snowflake, there is a sequence of characters
Sometimes Lana connects several snowflakes, but even then the size of each snowflake is determined separately,
regardless of whether the snowflakes share some characters.
On the left is an example of a snowflake of size
In the middle is an example of connected snowflakes, the left one of size and the right one of size
On the right is an example of a snowflake of size It is missing one character to be of size
Lana is currently drawing snowflakes on a piece of paper of size
draw all the snowflakes completely in accordance with her usual snowflake shapes. Namely, some snowflakes are missing some characters, so their size is equal to the smallest length of the corresponding character sequence from the center in one of the eight directions. Moreover, she drew some characters that are not part of any snowflake.
Can you help Lana determine the size of the largest snowflake in the drawing?
However, she got a bit confused and did not
mtimes n
x x
x
x
x
Input Specification
The first line contains two integers and the size of the drawing. In each of the following lines there are characters describing the drawing.
The characters that can appear in the drawing are and The ASCII values of these characters are and respectively.
Output Specification
In the first and only line, you should output the size of the largest snowflake in the drawing.
Constraints
Subtask
Points
Constraints
There won't be any snowflake, or the largest snowflake will be of size
There will be at most one character in the drawing.
No additional constraints.
Sample Input
Sample Output
Explanation for Sample
Only one snowflake is drawn.
mn m n m n
In the directions upleft, up and upright from the center of the snowflake, there are sequences of length In the directions right and downright from the center of the snowflake, there are sequences of length In the directions left, downleft and down from the center of the snowflake, there are sequences of length
Therefore, the size of the snowflake is
Sample Input
Sample Output
Explanation for Sample
Two connected snowflakes are drawn, the left one of size and the right one of size
Sample Input
Sample Output
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started