QOJ.ac

QOJ

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

#22752. Foto de satélite

Statistics

Farmer John queria bom mapa da fazenda, comprou foto de satélite de $R$ linhas ($1 \le R \le 75$), $C$ colunas ($1 \le C \le 75$). Uma parte é assim:

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

Cada forma conexa é celeiro ou vaca. Forma conexa é conjunto de um ou mais '#' adjacentes vertical ou horizontalmente. Eis duas distintas:

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

Retângulo preenchido com lados paralelos aos eixos $x$, $y$ é celeiro. Primeira foto tem3 celeiros ($2\times1$, $2\times5$, $1\times1$),2 vacas (o tamanho surpreende!). Conte celeiros e vacas.

Uma vaca nunca cerca completamente outra ou celeiro.

Entrada

  • Linha1: dois inteiros separados por espaço $R$, $C$.
  • Linhas $2$ a $R+1$: linha $i+1$ representa fileira $i$ com $C$ caracteres sem espaços.

Saída

  • Linha1: celeiros.
  • Linha2: vacas.

Exemplos

Entrada 1

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

Saída 1

2
2

Nota

Detalhes da entrada

Foto de5 linhas de8 caracteres.

Detalhes da saída

2 celeiros (esquerda),2 vacas (direita).

Autor do problema: 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.