#P9908. [COCI 2023/2024 #2] Pahuljice

    ID: 11231 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 3 上传者: 标签>搜索2023O2优化枚举COCI(克罗地亚)

[COCI 2023/2024 #2] Pahuljice

Problem Description

Lana likes drawing snowflakes. A snowflake of size xx is defined as follows.

  • The center of the snowflake is a ’+’\texttt{'+'}.
  • There are xx ’|’\texttt{'|'} characters above and xx ’|’\texttt{'|'} characters below the ’+’\texttt{'+'}.
  • There are xx ’-’\texttt{'-'} characters to the left and xx ’-’\texttt{'-'} characters to the right of the ’+’\texttt{'+'}.
  • There are xx ’\’\texttt{'\textbackslash'} characters to the upper-left and xx ’\’\texttt{'\textbackslash'} characters to the lower-right of the ’+’\texttt{'+'}.
  • There are xx ’/’\texttt{'/'} characters to the lower-left and xx ’/’\texttt{'/'} characters to the upper-right of the ’+’\texttt{'+'}.

Snowflakes may overlap. Below are some examples of snowflakes.

The three pictures contain, respectively: one snowflake of size 11; two overlapping snowflakes of sizes 22 and 11; and one snowflake of size 11 (because a size 22 snowflake is incomplete).

Given an n×mn \times m character matrix, find the size of the largest snowflake in it.

Input Format

The first line contains two integers n,mn, m.

The next nn lines each contain a string of length mm, describing an n×mn \times m matrix. It is guaranteed to contain only $\texttt{'+'}, \texttt{'-'}, \texttt{'|'}, \texttt{'/'}, \texttt{'\textbackslash'}, \texttt{'.'}$.

Output Format

Output one integer: the size of the largest snowflake. If there is none, output 00.

5 6
\.\|/.
---+--
/./|\.
./.|.\
/..|..
1

7 7
\.|./..
.\|/...
--+--..
./|\...
/.|.\|/
....-+-
..../|\
2
7 7
\|/|\|/
-+-|-+-
/|\|/|\
---+---
\|/|\|/
-+-|-+-
/|\|/|\

1

Hint

Constraints

Subtask\text{Subtask} Score Special property
11 1111 The largest snowflake size is 11, or there is no snowflake at all.
22 There is at most one ’+’\texttt{'+'} in the matrix.
33 2828 None.

For all testdata, 1n,m501 \le n, m \le 50.

Translated by ChatGPT 5