#P10613. [PA 2008] Cliquers

    ID: 12088 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>动态规划 DP2008O2优化背包 DP根号分治PA(波兰)

[PA 2008] Cliquers

Problem Description

Count the number xx of essentially different graphs with nn vertices such that every connected component is a complete graph.

Compute mxmodPm^x \bmod P, where P=109401P=10^9-401 is a prime number.

Input Format

One line with two integers, nn and mm.

Output Format

One line with one integer, representing the required result.

3 2
8

Hint

Sample Explanation.

When n=3n=3, the 33 cases are shown in the figure below. Note that you should output the value of mxmodP=23mod(109401)m^x \bmod P=2^3 \bmod (10^9-401).

Constraints.

For all testdata, 1n,m2×1051\leq n,m\leq 2\times 10^5.

Translated by ChatGPT 5