![]() |
||||||||||
|
||||||||||
StabilityTime Limit: 3000/2000 MS (Java/Others) Memory Limit: 65535/102400 K (Java/Others)Total Submission(s): 2252 Accepted Submission(s): 542 Problem Description Given an undirected connected graph $G$ with $n$ nodes and $m$ edges, with possibly repeated edges and/or loops. The stability of connectedness between node $u$ and node $v$ is defined by the number of edges in this graph which determines the connectedness between them (once we delete this edge, node $u$ and $v$ would be disconnected). You need to maintain the graph $G$, support the deletions of edges (though we guarantee the graph would always be connected), and answer the query of stability for two given nodes. Input There are multiple test cases(no more than $3$ cases), and the first line contains an integer $t$, meaning the totally number of test cases. For each test case, the first line contains three integers $n$, $m$ and $q$, where $1 \le n \le 3 \times 10^4, 1 \le m \le 10^5$ and $1 \le q \le 10^5$. The nodes in graph $G$ are labelled from $1$ to $n$. Each of the following $m$ lines contains two integers $u$ and $v$ describing an undirected edge between node $u$ and node $v$. Following $q$ lines - each line describes an operation or a query in the formats: $\cdot$ $1~a~b$: delete one edge between $a$ and $b$. We guarantee the existence of such edge. $\cdot$ $2~a~b$: query the stability between $a$ and $b$. Output For each test case, you should print first the identifier of the test case. Then for each query, print one line containing the stability between corresponding pair of nodes. Sample Input
Sample Output
Source | ||||||||||
|