QOJ.ac

QOJ

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

#22752. Satellitenfoto

Statistics

Farmer John wollte eine gute Farmkarte und kaufte Satellitenfoto mit $R$ Zeilen ($1 \le R \le 75$), $C$ Spalten ($1 \le C \le 75$). Teilweise so:

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

Jede zusammenhängende Form ist Scheune oder Kuh. Sie besteht aus mindestens einem '#' mit vertikaler oder horizontaler Nachbarschaft. Hier zwei verschiedene Formen:

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

Ein ausgefülltes Rechteck mit Seiten parallel zu $x$- und $y$-Achsen ist Scheune. Erstes Foto:3 Scheunen ($2\times1$, $2\times5$, $1\times1$),2 Kühe (erstaunliche Größen!). Zähle Scheunen und Kühe.

Eine Kuh umschließt nie vollständig andere Kuh oder Scheune.

Eingabe

  • Zeile1: zwei ganze Zahlen mit Leerzeichen $R$, $C$.
  • Zeilen $2$ bis $R+1$: Zeile $i+1$ zeigt Fotozeile $i$ mit $C$ Zeichen ohne Leerzeichen.

Ausgabe

  • Zeile1: Scheunenzahl.
  • Zeile2: Kuhzahl.

Beispiele

Eingabe 1

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

Ausgabe 1

2
2

Hinweis

Eingabeerklärung

Foto5 Zeilen je8 Zeichen.

Ausgabeerklärung

2 Scheunen (links),2 Kühe (rechts).

Aufgabenautor: 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.