Universal Cup Judging System

Universal Cup

Süre Sınırı: 2.0 s Bellek Sınırı: 1024 MB Toplam puan: 100 Hack'lenebilir ✓
İstatistikler

畀你整數 $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.