Processing math: 100%
Remove edge - MarisaOJ: Marisa Online Judge

Remove edge

Time limit: 1000 ms
Memory limit: 256 MB
Given a connected, undirected graph of n vertices and m edges. There are q queries, each of the form (e,c). After removing the eth edge, how many vertices are in the same connected component with c. It is guaranteed that each edge is removed at most one time. ### Input - The first line contain 3 integers n,m,q. - The next m lines, each line contains 2 integers u,v, there is an edge between u,v. - The next q lines, each line contains 2 integers e,c, a query. ### Output - Print q lines, the ith is the answer to query i. ### Constraints - 1≤n,m,q≤105. - 1≤u,v≤n. - 1≤e≤m. - 1≤c≤n. ### Example Input: 44312233424442311 Output: 421