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$),2 פרות (גודלן מפתיע!). ספרו אסמים ופרות.

פרה לעולם לא מקיפה לגמרי פרה אחרת או אסם.

קלט

  • שורה1: שני שלמים ברווח $R$, $C$.
  • שורות $2$ עד $R+1$: שורה $i+1$ מייצגת שורת צילום $i$ עם $C$ תווים ללא רווחים.

פלט

  • שורה1: מספר אסמים.
  • שורה2: מספר פרות.

דוגמאות

קלט 1

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

פלט 1

2
2

הערה

הסבר הקלט

צילום5 שורות כל אחת8 תווים.

הסבר הפלט

2 אסמים בשמאל,2 פרות בימין.

מחבר הבעיה: 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.