시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
4 초 | 512 MB | 42 | 21 | 19 | 59.375% |
A mason’s mark is a symbol often found on dressed stones in buildings and other public structures. As Peter walks with his camera through Paris, he notices these marks on the wall of the Tour JeanSans-Peur. Every stone has one of the marks A, B or C, which are quite visible. He makes a black and white photo and observes:
You are given a rectangular matrix representing a picture made by Peter. The ‘#’ character represents a black pixel and the ‘.’ character a white pixel. You should count how many stones are on the picture with the respective letters A, B, and C.
The first line contains two integers W and H. The next H lines each contain a string of length W. The strings are composed of ‘.’ and ‘#’.
The output should consist of a single line, whose content is three integers A, B, and C separated with single spaces, indicating the number of stones with the respective marks A, B, and C.
26 15 ########################## ##........######......#..# #...###....#####..#......# #...#.#....####.........## #...###.....##....#####..# #...#.#.....#.....#####..# #...###.....#.....##.##..# #........#..#.#...#####..# #..###......#.....#####..# #..#........#...#.##.##..# #..#........#.....##.##..# #..#...#.#..#...#.##.##..# #..###......#............# ###....#....##....##.....# ##########################
1 1 0
There are black pixels forming a letter C. These pixels however belong to the region around the stones and do not form a mark, since they are not surrounded by white pixels.
ICPC > Regionals > Europe > Southwestern European Regional Contest > SWERC 2018 I번