#P6351. Edge Removal and Two Edge-Disjoint Paths
Edge Removal and Two Edge-Disjoint Paths
Edge Removal and Two Edge-Disjoint Paths
You are given an undirected graph with \(n\) vertices and \(m\) edges. Then there are \(q\) queries. Each query is given by a character \(opt\) and two integers \(x\) and \(y\).
If \(opt = Z\), then it represents a deletion operation, and the edge \((x,y)\) is removed from the graph. It is guaranteed that the edge \((x,y)\) has not been deleted before, although the edge may not exist in the graph initially.
If \(opt = P\), then it is a query asking whether there exist two completely different (i.e. edge-disjoint) paths between \(x\) and \(y\). Two paths are considered completely different if they do not share any common edge, although they may have common vertices.
For each query of type \(P\), output Yes if there exist two edge-disjoint paths between \(x\) and \(y\) in the current graph, and No otherwise.
inputFormat
The input begins with a line containing three integers \(n\), \(m\) and \(q\) representing the number of vertices, the number of edges, and the number of queries respectively.
The next \(m\) lines each contain two integers \(u\) and \(v\) representing an undirected edge between vertices \(u\) and \(v\).
The following \(q\) lines each contain a character \(opt\) and two integers \(x\) and \(y\). If \(opt\) is 'Z' then delete the edge \((x,y)\) (if it exists). If \(opt\) is 'P' then answer whether there exist two edge-disjoint paths between \(x\) and \(y\) in the current graph.
outputFormat
For each query with \(opt = P\), output a single line containing either "Yes" or "No" indicating whether there exist two edge-disjoint paths between \(x\) and \(y\) in the current graph.
sample
4 3 4
1 2
2 3
3 4
P 1 4
Z 2 3
P 1 4
P 2 3
No
No
No
</p>