QOJ.ac

QOJ

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

#3086. 辺の部分集合

Estadísticas

$N$ 頂点 $M$ 辺の単純無向グラフと整数 $A, B$ が与えられる。頂点には $1$ から $N$ までの番号が、辺には $1$ から $M$ までの番号が付けられている。辺 $i$ は頂点 $U_i$ と $V_i$ を結んでいる。ここで、$V_i - U_i = A$ または $V_i - U_i = B$ であることが保証されている。

このグラフのマッチングの個数を $998244353$ で割った余りを求めよ。なお、グラフのマッチングとは、どの2つの辺も端点を共有しないような辺の集合のことである。

入力

1行目には整数 $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.