QOJ.ac

QOJ

Time Limit: 7 s Memory Limit: 512 MB Total points: 100

#45. Tutte多项式

统计

题目描述

对于一个无向图 $G = (V, E)$,Tutte 多项式可以定义为 $T_G(x,y)=\sum_{A\subseteq E}(x-1)^{k(A)-k(E)}(y-1)^{k(A)+|A|-|V|}$,其中 $k(E)$ 表示图 $(V, E)$ 的连通分量数。它还有一些看起来更简洁自然的定义和很多优秀的性质,但在这题只需要知道这个定义。

在一些 $(x, y)$ 上,Tutte 多项式和一些计数问题相关。一个图的 Tutte 多项式等于它的所有连通分量的 Tutte 多项式之积,为了方便,以下假设图 $G$ 连通。

容易观察到 $T_G(1, 1)$ 是 $G$ 的生成树(即无环连通生成子图)数量,$T_G(2, 1)$ 是 $G$ 的生成森林(即无环生成子图)数量,$T_G(1, 2)$ 为 $G$ 的连通生成子图数量,$T_G(2, 2)$ 是 $G$ 的生成子图数量,即 $2^{|E|}$。

$y=0$ 时有 $P_G(k)=(-1)^{|V|-k(E)}\;\; k^{k(E)} T_G(1-k, 0)$,$P_G(k)$ 表示 $G$ 的色多项式,是 $G$ 的顶点 $k$ 染色的数量。

$x=0$ 时有 $C_G(k)=(-1)^{|E|-|V|+k(E)}\;\;T_G(0, 1-k)$,$C_G(k)$ 表示 $G$ 的流多项式,是 $G$ 的无处为零 $k$-流的数量。

对一个无重边无自环的图 $G=(V, E)=(\{0, 1, \ldots, n-1\}, E)$,求 $T_G(x, y) \bmod 998244353$。

输入格式

第 $1$ 行:$n$

第 $2+i$ 行($0 \leq i \leq n−1$):$G_{i, 0}\ G_{i, 1}\ \ldots G_{i, n-1}$,$G_{i, j}$ 为 $0$ 表示 $(i, j) \notin E$ ,为 $1$ 表示 $(i, j) \in E$

第 $2+n$ 行:$x\ y$

输出格式

第 $1$ 行:$T_G(x, y) \bmod 998244353$

样例数据

样例输入

5
0 1 1 0 1
1 0 0 1 1
1 0 0 1 1
0 1 1 0 0
1 1 1 0 0
[x] [y]

[x][y] 是输入的 $x$ 和 $y$,样例输出中给出了一些可能的 $(x, y)$ 对应的输出。

样例输出

$(x, y)$ $T_G(x, y) \bmod 998244353$
$(0, 1)$ $6$
$(0, 2)$ $24$
$(1, 0)$ $10$
$(1, 1)$ $24$
$(1, 2)$ $52$
$(2, 0)$ $60$
$(2, 1)$ $86$

子任务

  • $1 \leq n \leq 21$
  • $G_{i, j} \in \{0, 1\}, G_{i, j} = G_{j, i}, G_{i, i} = 0$
  • $0 \leq x, y < 998244353$

Subtasks

  1. (16 分)$n \leq 7$
  2. (20 分)$n \leq 11$
  3. (14 分)$n \leq 14$
  4. (25 分)$n \leq 18$
  5. (25 分)没有附加限制
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.