QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22752. Zdjęcie satelitarne

Statistics

Farmer John chciał dobrą mapę farmy i kupił zdjęcie satelitarne $R$ wierszy ($1 \le R \le 75$), $C$ kolumn ($1 \le C \le 75$). Fragment:

..................
..#####.......##..
..#####......##...
..................
#.......###.....#.
#.....#####.......

Każdy spójny kształt to stodoła lub krowa. To zbiór jednego lub więcej '#' sąsiednich pionowo lub poziomo. Oto dwa różne kształty:

....
.#..
..#.
....

Wypełniony prostokąt z bokami równoległymi do osi $x$, $y$ to stodoła. Pierwsze zdjęcie:3 stodoły ($2\times1$, $2\times5$, $1\times1$),2 krowy (zaskakująco duże!). Policz stodoły i krowy.

Krowa nigdy nie otacza całkowicie innej lub stodoły.

Wejście

  • Wiersz1: dwie całkowite ze spacją $R$, $C$.
  • Wiersze $2$ do $R+1$: wiersz $i+1$ opisuje rząd $i$ z $C$ znakami bez spacji.

Wyjście

  • Wiersz1: stodoły.
  • Wiersz2: krowy.

Przykład

Wejście 1

5 8
#####..#
#####.##
......#.
.###...#
.###..##

Wyjście 1

2
2

Uwagi

Opis wejścia

Zdjęcie5 wierszy po8 znaków.

Opis wyjścia

2 stodoły po lewej,2 krowy po prawej.

Autor zadania: Brian Dean, 2004

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.