QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 256 MB مجموع النقاط: 100

#22360. פאזלים

الإحصائيات

הפרות מרכיבות פאזלי אותיות עם $R$ שורות ($(1 \le R \le 10)$) ו־$C$ עמודות ($(1 \le C \le 10)$). הקצוות הם אותיות במקום צורות קרטון מוזרות.

לכל חלק מספר ו־$4$ אותיות או גבולות שיש להתאים כרגיל. אות מדומה 0 (הספרה אפס) מציינת גבול. לחלק ייתכנו כמה גבולות בפינה או אפילו בראש עמודה בפאזל $4\times1$. ששת החלקים למטה הם פתרון אחד מרבים; גבולות מסומנים בקווים במקום 0.

              +---+  +---+  +---+
              | 1 c  c 3 d  d 5 |
              +-d-+  + a +  +-e-+
              +-d-+  +-a-+  +-e-+
              | 2 b  b 4 b  b 6 |
              +---+  +---+  +---+

אותיות בקצוות הנוגעים תואמות, והגבולות נמצאים כראוי למעלה, למטה ובצדדים.

חלק מתואר במספר ובארבעת קצותיו בכיוון השעון, אותיות $a,\ldots,z$ או 0. ייתכן שצריך לסובב בהנחה.

מצאו לפחות הרכבה אחת. בדיקות עם $R$ ו־$C$ גדולים קלות יותר בזכות מגוון אותיות רחב.

קלט

  • שורה $1$: השלמים $R$ ו־$C$ מופרדים ברווח.

  • שורות $2,\ldots,R\times C+1$: חמישה פריטים מופרדים ברווח, מספר שלם וארבעה מזהי קצוות.

פלט

  • שורות $1,\ldots,R\times C$: שורה $R\times (i-1)+j$ מתארת את החלק בשורה $i$ עמודה $j$ בחמישה פריטים: המספר השלם ואז הקצוות למעלה, ימין, למטה, שמאל.

דוגמאות

קלט 1

2 3
1 c d 0 0
2 0 d b 0
3 c 0 d a
4 b a b 0
5 d 0 0 e
6 0 0 b e

פלט 1

1 0 c d 0
3 0 d a c
5 0 0 e d
2 d b 0 0
4 a b 0 b
6 e 0 0 b

Note

הקלט מתאר את הפאזל אך חלק מהחלקים מסובבים לעומת פתרון הדוגמה.

כמו בתרשים. פתרונות אחרים, כגון שיקופים, אפשריים; תוכנת בדיקה בודקת את התשובה.

מחבר הבעיה: Rob Kolstad, 2008

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.