Filter
SRM 89 · 2002-05-16 · by dgoodman
Problem Statement
A 2-dimensional digital picture has been received from a satellite as a
1
111
1
Write a class Filter that contains the method removable that takes a
Notes
- Cross patterns may overlap. (See example 2)
Constraints
- picture contains between 1 and 50 elements, inclusive.
- each String in picture contains between 1 and 50 characters, inclusive.
- each String in picture has the same length.
- each String in picture contains only the characters '0' and '1' (zero and one).
{"00110",
"00110",
"00110"}
Returns: 6
There are no cross patterns. All the '1's can be removed.
{"00110",
"00111",
"00110"}
Returns: 2
There is one cross pattern. 2 of the '1's can be removed.
{"00111",
"01111",
"00110"}
Returns: 1
There are two (overlapping) cross patterns. Only the 1 in the upper right corner is not in some cross.
{"01000","11100","01110","00110"}
Returns: 1
{"1111","1001","1111"}
Returns: 10
Submissions are judged against all 27 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Language: C++17 · define a public class Filter with a public method int removable(vector<string> picture) · 27 test cases · 2 s / 256 MB per case