QOJ.ac

QOJ

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

#22752. Ảnh vệ tinh

Statistics

Farmer John muốn bản đồ tốt của trại nên mua ảnh vệ tinh $R$ hàng ($1 \le R \le 75$), $C$ cột ($1 \le C \le 75$). Một phần như sau:

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

Mỗi hình liên thông là chuồng hoặc bò. Là tập một hay nhiều '#' kề dọc hoặc ngang. Đây là hai hình riêng:

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

Chữ nhật đầy với bốn cạnh song song trục $x$, $y$ là chuồng. Ảnh đầu3 chuồng ($2\times1$, $2\times5$, $1\times1$),2 bò (kích thước bất ngờ!). Đếm chuồng và bò.

Bò không bao kín hoàn toàn bò khác hoặc chuồng.

Dữ liệu vào

  • Dòng1: hai số nguyên cách dấu cách $R$, $C$.
  • Các dòng $2$ tới $R+1$: dòng $i+1$ biểu diễn hàng $i$ với $C$ ký tự, không dấu cách.

Dữ liệu ra

  • Dòng1: số chuồng.
  • Dòng2: số bò.

Ví dụ

Dữ liệu vào 1

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

Dữ liệu ra 1

2
2

Ghi chú

Chi tiết đầu vào

Ảnh5 hàng mỗi8 ký tự.

Chi tiết đầu ra

2 chuồng bên trái,2 bò bên phải.

Tác giả bài toán: 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.