Ensure that you are logged in and have the required permissions to access the test.

Colorful Spanning Trees

5

2 votes
determinant, Linear Algebra, Hard, Mathematics, counting, Approved, interpolation
Problem

You are give an graph with multiple edges and without loops. Each edge have one of 2 colors -- black or white.

For each i between 0 and n1, inclusive, find number of spanning trees with exactly i white edges and n1i black edges.

As answers can be large, print them modulo 1,000,000,007.

Input Format:
First line contain single integer n -- number of vertices in a graph.
Then two tables n×n follows, separated by an empty line.
First table contains number of white edges between vertices, second black.

n
w11w1n

wn1wnn

b11b1n

bn1bnn

Output Format:
Output n space-separated numbers, i containing number of trees with i white and n1i black edges.

Constraints:
2n100.
0wij,bij1,000,000,006.
wii=bii=0.
wij=wji,bij=bji.

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

.

Editor Image

?