#abc310d. D - Peaceful Teams

D - Peaceful Teams

Score : 400400 points

问题描述

设有 NN 名运动员。

在这些运动员中,存在 MM 对不兼容的组合。第 ii1iM1\leq i\leq M)对不兼容组合是第 AiA_i 号和第 BiB_i 号运动员。

你需要将这些运动员分成 TT 支队伍。每个运动员必须且只能属于一支队伍,并且每支队伍至少要有一名运动员。另外,对于所有 i=1,2,,Mi=1,2,\ldots,M,第 AiA_i 号和第 BiB_i 号运动员不能分在同一支队伍中。

请找出满足上述条件的分配方式的数量。在这里,当两种分配方式中存在两名运动员在一个分配中属于同一队而在另一个分配中属于不同队时,这两种分配被认为是不同的。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

There are NN sports players.

Among them, there are MM incompatible pairs. The ii-th incompatible pair (1iM)(1\leq i\leq M) is the AiA_i-th and BiB_i-th players.

You will divide the players into TT teams. Every player must belong to exactly one team, and every team must have one or more players. Additionally, for each i=1,2,,Mi=1,2,\ldots,M, the AiA_i-th and BiB_i-th players must not belong to the same team.

Find the number of ways to satisfy these conditions. Here, two divisions are considered different when there are two players who belong to the same team in one division and different teams in the other.

Constraints

  • 1TN101\leq T\leq N\leq10
  • 0MN(N1)20\leq M\leq\dfrac{N(N-1)}2
  • 1Ai<BiN (1iM)1\leq A _ i\lt B _ i\leq N\ (1\leq i\leq M)
  • $(A _ i,B _ i)\neq (A _ j,B _ j)\ (1\leq i\lt j\leq M)$
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN TT MM

A1A _ 1 B1B _ 1

A2A _ 2 B2B _ 2

\vdots

AMA _ M BMB _ M

Output

Print the answer in a single line.

Sample Input 1

5 2 2
1 3
3 4

Sample Output 1

4

The following four divisions satisfy the conditions.

No other division satisfies them, so print 44.

Sample Input 2

5 1 2
1 3
3 4

Sample Output 2

0

There may be no division that satisfies the conditions.

Sample Input 3

6 4 0

Sample Output 3

65

There may be no incompatible pair.

Sample Input 4

10 6 8
5 9
1 4
3 8
1 6
4 10
5 7
5 6
3 7

Sample Output 4

8001

update @ 2024/3/10 08:48:18