Universal Cup Judging System

Universal Cup

시간 제한: 2.0 s 메모리 제한: 1024 MB 총점: 100 해킹 가능 ✓
통계

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