Universal Cup Judging System

Universal Cup

Límite de tiempo: 2.0 s Límite de memoria: 1024 MB Puntuación total: 100 Hackeable ✓
Estadísticas

정수 $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.