QOJ.ac

QOJ

时间限制: 1 s 内存限制: 256 MB 总分: 100 难度: [显示] 可 Hack ✓

#18881. מפתח, הוסף את זה בבקשה!

统计

Jaemin פיתח יישומון של משחק חידות.

כדור מונח באחד התאים של רשת. אפשר לגלגל את הכדור למעלה, למטה, שמאלה או ימינה. הכדור מתגלגל בכיוון הזה עד שהוא פוגע בקיר או בגבול הרשת. בחלק מהתאים יש כוכבים, והשחקן מקבל כוכב כשהכדור נעצר בתא שלו או עובר דרכו. מטרת המשחק היא לאסוף את כל הכוכבים ברשת.

ביישומון הזה יש עורך שלבים שבו שחקנים יכולים ליצור ולשתף שלבים משלהם. יום אחד מישהו הציע: ״הוסף בבקשה תכונה שתבדוק אם אפשר לפתור את השלב שלי!״ קל יותר לומר מאשר לעשות, נכון?

קלט

השורה הראשונה של הקלט מכילה שני מספרים שלמים, $H$ (גובה) ו־$W$ (רוחב). ($1 \leq H, W \leq 50$) כל אחת מ־$H$ השורות הבאות מכילה מחרוזת באורך $W$ המתארת שורה ברשת. ״#״ מציין קיר, ״.״ מציין תא ריק, ״O״ מציין כדור, ו־״*״ מציין כוכב. ברשת יש בדיוק כדור אחד ולפחות כוכב אחד.

פלט

הדפיסו ״YES״ אם אפשר לאסוף את כל הכוכבים, ואחרת הדפיסו ״NO״.

דוגמאות

קלט 1

3 7
#..O..#
#.###.#
*..#..*

פלט 1

NO

קלט 2

6 6
*..*##
..O...
*..*#.
####*.
......
.....#

פלט 2

YES

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#3141EditorialOpenNew Editorial for Problem #18881nullptr_qwqView

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.