atcoder#AGC046F. [AGC046F] Forbidden Tournament

[AGC046F] Forbidden Tournament

Score : 20002000 points

Problem Statement

Given are integers NN and KK, and a prime number PP. Find the number, modulo PP, of directed graphs GG with NN vertices that satisfy below. Here, the vertices are distinguishable from each other.

  • GG is a tournament, that is, GG contains no duplicated edges or self-loops, and exactly one of the edges uvu\to v and vuv\to u exists for any two vertices uu and vv.
  • The in-degree of every vertex in GG is at most KK.
  • For any four distinct vertices aa, bb, cc, and dd in GG, it is not the case that all of the six edges aba\to b, bcb\to c, cac\to a, ada\to d, bdb\to d, and cdc\to d exist simultaneously.

Constraints

  • 4N2004 \leq N \leq 200
  • N12KN1\frac{N-1}{2} \leq K \leq N-1
  • $10^8
  • NN and KK are integers.
  • PP is a prime number.

Input

Input is given from Standard Input in the following format:

NN KK PP

Output

Print the number of directed graphs that satisfy the conditions, modulo PP.

4 3 998244353
56

Among the 6464 graphs with four vertices, 88 are isomorphic to the forbidden induced subgraphs, and the other 5656 satisfy the conditions.

7 3 998244353
720
50 37 998244353
495799508