题目来源于牛客竞赛:https://ac.nowcoder.com/acm/contest/discuss
题目描述:
You are given an undirected graph with N vertices and M edges. The edges are numbered from 1 to M. Denote the set S(x) as: All the vertices we can reach from vertex x by exactly one edge.
You are supposed to deal with Q operations of the following two types: (1,l,r)-- reverse the status of edges numbered between l to r(1≤l≤r≤M). i e.Delete the edge if it is in the graph, otherwise add it to the graph.
(2,u,v) – ask whether S(u) and S(v) are exactly the same (1≤u≤v≤N
).
Note that all the M edges are in the graph at the beginning.
输入描述:
The input contains multiple cases. The first line of the input contains a single positive integer T, the number of cases.
For each case, the first line contains two integers N (1≤N≤100000) and M (1≤M≤200000), the number of vertices and edges in the graph. In the following M lines, the i-th line contains two integers ui,vi(1≤ui,vi≤N), describing the the i-th edge (ui,vi). Each edge appears in the input at most once. The (M+2)-th line contains a integer Q(1≤Q≤200000) , the number of operations. In the follo