QOJ.ac

QOJ

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

#22752. صورة قمر صناعي

Statistics

أراد Farmer John خريطة جيدة لمزرعته فاشترى صورة قمر صناعي من $R$ صفوف ($1 \le R \le 75$) و$C$ أعمدة ($1 \le C \le 75$). جزء منها:

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

كل شكل متصل حظيرة أو بقرة. هو مجموعة واحد أو أكثر '#' متجاورة رأسيًا أو أفقيًا. هذان شكلان مختلفان:

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

مستطيل ممتلئ أضلاعه موازية للمحورين $x$ و$y$ حظيرة. الصورة الأولى3 حظائر ($2\times1$ و$2\times5$ و$1\times1$) وبقرتان (حجم بعض الأبقار مفاجئ!). عد الحظائر والأبقار.

لا تحيط بقرة بالكامل بأخرى أو حظيرة.

الإدخال

  • السطر1: عددان صحيحان بفراغ $R$ و$C$.
  • الأسطر $2$ إلى $R+1$: السطر $i+1$ يمثل الصف $i$ وفيه $C$ محارف بلا فراغات.

الإخراج

  • السطر1: عدد الحظائر.
  • السطر2: عدد الأبقار.

أمثلة

الإدخال 1

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

الإخراج 1

2
2

ملاحظة

شرح الإدخال

الصورة5 صفوف كل منها8 محارف.

شرح الإخراج

حظيرتان يسارًا وبقرتان يمينًا.

مؤلف المسألة: 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.