#P9005. [RC-07] 超超立方体
[RC-07] 超超立方体
Problem Description
There is an -dimensional hypercube of size . The coordinates of the lower-left corner are , and the coordinates of the upper-right corner are .
Consider an undirected graph with labeled vertices. The label of a vertex is , and each vertex corresponds to an integer lattice point inside or on the boundary of the hypercube. For a pair of vertices in the graph, there is an edge between them if and only if is parallel to an edge of the hypercube. In other words, .
Compute the number of spanning trees of this graph modulo .
Input Format
The first line contains a positive integer .
The next line contains positive integers .
Output Format
Output the answer modulo .
1
5
125
5
2 3 4 5 6
676736091
Hint
All testdata satisfy: , .
- Subtask ( points): .
- Subtask ( points): .
- Subtask ( points): .
- Subtask ( points): No special constraints.
Translated by ChatGPT 5