#P10594. BZOJ2445 最大团

    ID: 12075 远端评测题 1000ms 512MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>O2优化中国剩余定理 CRTLucas 定理

BZOJ2445 最大团

Background

This problem comes from the original BZOJ. We acknowledge that the copyright of the statement and the original testdata belongs to the original BZOJ, or to the problem setter who authorized BZOJ to use it. If you are the copyright owner and believe that we have infringed your rights, please contact us.

Problem Description

An undirected graph with nn vertices is called a symmetric labeled cliquer if and only if every maximal connected component of the graph has the same number of vertices, and every maximal connected component is a complete graph.

Now there are mm colors and all symmetric labeled cliquer graphs with nn labeled vertices. We need to color each symmetric labeled cliquer with one color. Two different symmetric labeled cliquer graphs may have the same color. Find the number of coloring schemes modulo 10940110^9-401.

Input Format

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

Each of the following lines contains two positive integers n,mn, m, with the meaning as described above.

Output Format

Output TT lines. For each test case, output the answer on one line.

1
4 2
32

Hint

Constraints guarantee that 1T21\leq T\leq 2 and 1n,m2×1091\leq n,m\leq 2\times 10^9.

Translated by ChatGPT 5