eolymp
bolt
Try our new interface for solving problems
Məsələlər

Oil Skimming

Oil Skimming

Thanks to a certain "green" resources company, there is a new profitable industry of oil skimming. There are large slicks of crude oil floating in the Gulf of Mexico just waiting to be scooped up by enterprising oil barons. One such oil baron has a special plane that can skim the surface of the water collecting oil on the water's surface. However, each scoop covers a \textbf{10}m by \textbf{20}m rectangle (going either east/west or north/south). It also requires that the rectangle be completely covered in oil, otherwise the product is contaminated by pure ocean water and thus unprofitable! Given a map of an oil slick, the oil baron would like you to compute the maximum number of scoops that may be extracted. The map is an \textbf{N}×\textbf{N} grid where each cell represents a \textbf{10}m square of water, and each cell is marked as either being covered in oil or pure water. \InputFile The input starts with an integer \textbf{K} (\textbf{1} ≤ \textbf{K} ≤ \textbf{100}) indicating the number of cases. Each case starts with an integer \textbf{N}(\textbf{1 ≤} \textbf{N} ≤ \textbf{600}) indicating the size of the square grid. Each of the following \textbf{N} lines contains \textbf{N} characters that represent the cells of a row in the grid. A character of '\textbf{#}' represents an oily cell, and a character of '\textbf{.}' represents a pure water cell. \OutputFile For each case, one line should be produced, formatted exactly as follows: "\textbf{Case X: M}" where \textbf{X} is the case number (starting from \textbf{1}) and \textbf{M} is the maximum number of scoops of oil that may be extracted.
Zaman məhdudiyyəti 1 saniyə
Yaddaşı istafadə məhdudiyyəti 64 MiB
Giriş verilənləri #1
1
6
......
.##...
.##...
....#.
....##
......
Çıxış verilənləri #1
Case 1: 3
Mənbə The 2011 South Pacific Programming Contest