F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Stability

Time Limit: 3000/2000 MS (Java/Others)    Memory Limit: 65535/102400 K (Java/Others)
Total Submission(s): 2249    Accepted Submission(s): 541


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
1 10 12 14 1 2 1 3 2 4 2 5 3 6 4 7 4 8 5 8 6 10 7 9 8 9 8 10 2 7 9 2 7 10 2 10 6 2 10 5 1 10 6 2 10 1 2 10 6 2 3 10 1 8 5 2 5 10 2 4 5 1 7 9 2 7 9 2 10 5
 

Sample Output
Case #1: 0 0 0 0 2 4 3 3 2 3 4
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-20 07:12:12, Gzip enabled