Universal Cup Judging System

Universal Cup

Limite de temps : 2.0 s Limite de mémoire : 1024 MB Points totaux : 100 Hackable ✓
Statistiques

נתונים לכם המספרים השלמים $H, W, A, B, C, D$.

ישנה רשת עם $H$ שורות ו-$W$ עמודות. התא בשורה ה-$i$ מלמעלה ובעמודה ה-$j$ משמאל נקרא תא $(i, j)$.

כל תא צבוע בלבן או בשחור. תא $(i, j)$ הוא שחור אם ורק אם $A \le i \le B$ ו-$C \le j \le D$; אחרת, הוא לבן.

אתם מציבים נורות בחלק מהתאים הלבנים של רשת זו. נורה המוצבת בתא לבן $(i, j)$ מאירה את כל התאים הלבנים המקיימים את שני התנאים הבאים:

  • הם נמצאים באותה שורה או באותה עמודה כמו התא $(i, j)$.
  • אין תא שחור בין התא $(i, j)$ לבין אותו תא.

הצבה של נורות נקראת חוקית אם היא מקיימת את שני התנאים הבאים:

  • כל תא לבן מואר על ידי נורה אחת לפחות.
  • אף תא שיש בו נורה אינו מואר על ידי נורה אחרת כלשהי.

מצאו את מספר ההצבות החוקיות של נורות, מודולו $998244353$.

קלט

הקלט ניתן בפורמט הבא:

H W A B C D
  • כל ערכי הקלט הם מספרים שלמים.
  • $1 \le A \le B \le H \le 5 \times 10^5$
  • $1 \le C \le D \le W \le 5 \times 10^5$
  • $(A, B) \ne (1, H)$
  • $(C, D) \ne (1, W)$

פלט

הדפיסו את התשובה.

דוגמאות

קלט 1

3 3 2 2 2 2

פלט 1

7

קלט 2

2 3 1 1 1 2

פלט 2

3

קלט 3

500000 500000 100000 200000 100000 250000

פלט 3

360665510

הערה

בדוגמה הראשונה, ישנן בדיוק $7$ הצבות חוקיות של נורות. תאים עם נורות ותאים לבנים המוארים על ידי נורות מוצגים בירוק באיורים.

problem_16233_1.png

חלק מההצבות אינן מקיימות את התנאים: במקרה השמאלי, קיים לפחות תא לבן אחד שאינו מואר על ידי אף נורה; במקרה הימני, ישנו תא לבן עם נורה המואר על ידי נורה אחרת. שני המקרים אינם חוקיים.

problem_16233_2.png

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.