QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 1024 MB Total points: 100 Hackable ✓

#3086. Подмножества рёбер

Statistics

Вам даны целые числа $A$, $B$ и простой неориентированный граф с $N$ вершинами и $M$ ребрами. Вершины пронумерованы от $1$ до $N$, а ребра — от $1$ до $M$. Ребро $i$ соединяет вершины $U_i$ и $V_i$. Гарантируется, что $V_i - U_i = A$ или $V_i - U_i = B$.

Найдите количество паросочетаний в графе по модулю $998244353$. Напомним, что паросочетание в графе — это подмножество ребер, у которых нет общих вершин.

Входные данные

Первая строка содержит целые числа $N$ ($3 \le N \le 200$), $M$ ($1 \le M \le 400$), $A$ и $B$ ($1 \le A < B \le N - 1$).

Следующие $M$ строк описывают ребра. $i$-я из этих строк содержит целые числа $U_i$ и $V_i$ ($1 \le U_i < V_i \le N$, $V_i - U_i = A$ или $V_i - U_i = B$). В графе отсутствуют петли и кратные ребра.

Выходные данные

Выведите ответ.

Примеры

Входные данные 1

4 3 1 2
1 2
1 3
3 4

Выходные данные 1

5

Входные данные 2

10 14 2 4
5 7
7 9
2 6
6 8
1 5
3 7
4 8
1 3
4 6
8 10
3 5
5 9
2 4
6 10

Выходные данные 2

225

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1018EditorialOpen题解Qiuly2026-02-14 02:06:51View

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.