P3100 [USACO14JAN] Building a Ski Course G
题目描述
滑雪场的设计图是一个 $M \times N$($1 \le M,N \le 100$)的矩阵,每个格子里用一个字母 `R`(表示粗糙)或者 `S`(表示平整)。
比如:
```
RSRSSS
RSRSSS
RSRSSS
```
农民约翰的拖拉机每次可以将一块 $B \times B$($B \le M, B \le N$)的区域全部标记 $B \times B$($B \le M, B \le N$)的 `R` 或者 `S`,他希望 `B` 能够尽量地大。一个格子可以被多次标记,下一次标记能够覆盖前一次标记,每个格子可以都至少被标记一次。
输入格式
\* Line 1: Two space-separated integers M and N.
\* Lines 2..M+1: M lines of exactly N characters (each R or S), describing the desired ski course design.
输出格式
\* Line 1: The maximum value of B Farmer John can use to create the desired course pattern.
说明/提示
FJ can stamp a rough patch spanning columns 1-3, followed by a smooth patch spanning columns 2-4, then a rough patch spanning columns 3-5, and finally a smooth patch spanning columns 4-6.