Problem J. Problem C. Dynamic Graph Matching
时间限制 2 ms
内存限制 512 MB
In the mathematical discipline of graph theory, a matching in a graph is a set of edges without common vertices.
You are given an undirected graph with $n$ vertices, labeled by $1,2,...,n$. Initially the graph has no edges.
There are $2$ kinds of operations :
+ u v, add an edge $(u,v)$ into the graph, multiple edges between same pair of vertices are allowed.
- u v, remove an edge $(u,v)$, it is guaranteed that there are at least one such edge in the graph.
Your task is to compute the number of matchings with exactly $k$ edges after each operation for $k=1,2,3,...,\frac{n}{2}$. Note that multiple edges between same pair of vertices are considered different.
输入数据
输出数据
For each operation, print a single line containing $\frac{n}{2}$ integers, denoting the answer for $k=1,2,3,...,\frac{n}{2}$. Since the answer may be very large, please print the answer modulo $10^9+7$.
样例输入
复制
1
4 8
+ 1 2
+ 3 4
+ 1 3
+ 2 4
- 1 2
- 3 4
+ 1 2
+ 3 4
样例输出
复制
1 0
2 1
3 1
4 2
3 1
2 1
3 1
4 2
$ Mathjax font initiator $