#574. 「Nowcoder多校 2019 Day3」Graph Games
「Nowcoder多校 2019 Day3」Graph Games
当前没有测试数据。
题目描述
You are given an undirected graph with vertices and edges. The edges are numbered from to . Denote the set as: All the vertices we can reach from vertex by exactly one edge.
You are supposed to deal with operations of the following two types: -- reverse the status of edges numbered between to . i.e. Delete the edge if it is in the graph, otherwise add it to the graph. -- ask whether and are exactly the same .
Note that all the edges are in the graph at the beginning.
输入格式
The input contains multiple cases. The first line of the input contains a single positive integer , the number of cases.
For each case, the first line contains two integers and , the number of vertices and edges in the graph. In the following lines, the -th line contains two integers , describing the the -th edge . Each edge appears in the input at most once. The -th line contains a integer , the number of operations. In the following lines, each line contains three integers, describing an operation.
The total sum of over all cases does not exceed . The total sum of over all cases does not exceed . The total sum of over all cases does not exceed .
输出格式
For each case, print a string in a line. The length of the string should equal the number of operations of type . If the answer is yes, the -th character of the string should be '1', otherwise it should be '0'. Check the samples for more details.
样例
样例输入 1
1
5 4
1 2
1 3
4 2
4 3
3
2 1 4
1 1 1
2 1 2
样例输出 1
10