QOJ.ac

QOJ

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

#3086. 간선 부분집합

Statistiques

정수 $A, B$와 $N$개의 정점, $M$개의 간선으로 이루어진 단순 무방향 그래프가 주어집니다. 정점은 $1$부터 $N$까지, 간선은 $1$부터 $M$까지 번호가 매겨져 있습니다. $i$번째 간선은 정점 $U_i$와 $V_i$를 연결합니다. 이때, 모든 간선에 대해 $V_i - U_i = A$ 또는 $V_i - U_i = B$임이 보장됩니다.

이 그래프의 매칭(matching) 개수를 $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.