#P9036. 「KDOI-04」挑战 NPC Ⅲ

    ID: 9922 远端评测题 2500ms 512MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>搜索图论贪心2023洛谷原创O2优化枚举深度优先搜索 DFS剪枝组合数学洛谷月赛状压 DP

「KDOI-04」挑战 NPC Ⅲ

Background

Problem Description

Xiao S has a great dream: to prove that P=NP\text{P}=\text{NP}.

One day, after learning that the maximum independent set problem on general graphs is an NPC problem, he decided to solve it.

Of course, Xiao S is too weak to solve it, so he asks you for help:

Given an undirected graph GG with nn vertices and mm edges, find the number of independent sets in GG whose size is exactly nkn-k. Since the answer may be very large, output it modulo 998 244 353998~244~353.

Xiao S does not like multiple test cases, because he lost points in NOIp due to multiple test cases, so this problem contains multiple groups of testdata.

Input Format

This problem contains multiple groups of testdata.

The first line contains a positive integer TT, the number of test cases.

For each test case, the first line contains three positive integers n,m,kn,m,k.

The next mm lines each contain two positive integers u,vu,v, representing an edge.

It is guaranteed that there are no self-loops in the graph, but there may be multiple edges.

Output Format

For each test case, output one line with one positive integer, the number of independent sets that meet the requirement, modulo 998 244 353998~244~353.

3
4 6 1
1 2
1 3
1 4
2 3
2 4
3 4
4 6 3
1 2
1 3
1 4
2 3
2 4
3 4
8 13 5
1 2
7 8
1 3 
2 5
3 8
6 8
4 7
5 6
5 7
5 8
6 7
1 8
3 5
0
4
8

Hint

[Sample Explanation]

For test cases 11 and 22, the graph is a complete graph. It is easy to see that the maximum independent set of a complete graph has size 11, and each single vertex forms an independent set. Therefore, the answer for test case 11 is 00, and the answer for test case 22 is 44.

For test case 33, the undirected graph is as follows:

All independent sets of size 33 are:

  • {2,4,8}\{2,4,8\}
  • {2,3,7}\{2,3,7\}
  • {3,4,6}\{3,4,6\}
  • {2,4,6}\{2,4,6\}
  • {1,4,6}\{1,4,6\}
  • {2,3,6}\{2,3,6\}
  • {1,4,5}\{1,4,5\}
  • {2,3,4}\{2,3,4\}

[Constraints]

This problem uses bundled tests.

Constraints

For 100%100\% of the data, it is guaranteed that 1n1051\leq n\leq10^5, 0m1050\le m\le 10^5, 0kmin(n1,18)0\leq k\leq \min(n-1,18), 1T1041\leq T\leq 10^{4}, n,m106\sum n,\sum m\leq10^6.

Also, for each test point:

Let K=maxkK=\max k, i.e. the maximum value of kk among all test cases in this test point.

  • If K17K\ge 17, then T=1T=1
  • If K15K\ge 15, then T3T\le 3
  • If K10K\ge 10, then T5T\le 5
  • If K5K\ge 5, then T300T\le 300

Translated by ChatGPT 5