QOJ.ac

QOJ

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

#3086. Tập con cạnh

Statistics

Bạn được cho các số nguyên $A, B$ và một đồ thị vô hướng đơn với $N$ đỉnh và $M$ cạnh. Các đỉnh được đánh số từ 1 đến $N$, và các cạnh từ 1 đến $M$. Cạnh thứ $i$ nối hai đỉnh $U_i$ và $V_i$. Ở đây, đảm bảo rằng $V_i - U_i = A$ hoặc $V_i - U_i = B$.

Tìm số lượng bộ ghép (matching) của đồ thị, theo modulo 998244353. Lưu ý rằng một bộ ghép của đồ thị là một tập hợp các cạnh mà mọi đỉnh đầu mút của chúng đều phân biệt.

Dữ liệu vào

Dòng đầu tiên chứa các số nguyên $N$ ($3 \le N \le 200$), $M$ ($1 \le M \le 400$), $A$ và $B$ ($1 \le A < B \le N - 1$).

$M$ dòng tiếp theo mô tả các cạnh. Dòng thứ $i$ trong số đó chứa hai số nguyên $U_i$ và $V_i$ ($1 \le U_i < V_i \le N$, $V_i - U_i = A$ hoặc $V_i - U_i = B$). Không có khuyên hoặc đa cạnh.

Dữ liệu ra

In ra kết quả.

Ví dụ

Dữ liệu vào 1

4 3 1 2
1 2
1 3
3 4

Dữ liệu ra 1

5

Dữ liệu vào 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

Dữ liệu ra 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.