TopCoder

餘切
$\Huge\text{pooh is 8}$

User's AC Ratio

79.2% (19/24)

Submission's AC Ratio

49.2% (31/63)

Tags

Description

Input Format

Output Format

Sample Input 1

10 7
w w w w w w w
w s s s s s w
w s s s s s w
w s w w w s w
w s s s w s w
w s b b w s w
w w w w w s w
s s s s s s w
s s s s s s w
w w w w w w w

Sample Output 1

7

Sample Input 2

5 3
s w s
s s s
w b w
w b w
s w s

Sample Output 2

5

Sample Input 3

5 3
s w s
w s w
s b s
w b w
s w s

Sample Output 3

-1

Hints

Problem Source

112 學年度全國資訊學科能力競賽
測資來源:TWPCA GitHub

Subtasks

No. Testdata Range Constraints Score
1 0~2 範例測資 0
2 3~7 迷宮裡的小鋼珠數量為 $1$ 37
3 0~13 迷宮裡的小鋼珠數量不超過 $2$ 29
4 0~16 無額外限制 34

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1000 1048576 65536 1 3 4
1 1000 1048576 65536 1 3 4
2 1000 1048576 65536 1 3 4
3 1000 1048576 65536 2 3 4
4 1000 1048576 65536 2 3 4
5 1000 1048576 65536 2 3 4
6 1000 1048576 65536 2 3 4
7 1000 1048576 65536 2 3 4
8 1000 1048576 65536 3 4
9 1000 1048576 65536 3 4
10 1000 1048576 65536 3 4
11 1000 1048576 65536 3 4
12 1000 1048576 65536 3 4
13 1000 1048576 65536 3 4
14 1000 1048576 65536 4
15 1000 1048576 65536 4
16 1000 1048576 65536 4