#P10774. Graph Connectivity After Edge Deletions
Graph Connectivity After Edge Deletions
Graph Connectivity After Edge Deletions
Given an undirected graph \(G = (V, E)\) with \(n\) vertices and \(m\) edges. You are given \(q\) queries. In each query, a set of edges is specified to be removed from the graph. Your task is to determine whether the graph remains connected after the deletion of these edges. It is guaranteed that the number of edges in each query does not exceed \(15\). The queries must be processed online.
inputFormat
The input begins with a line containing two integers \(n\) and \(m\) — the number of vertices and edges respectively. The next \(m\) lines each contain two integers \(u\) and \(v\), denoting an undirected edge between vertices \(u\) and \(v\). The following line contains an integer \(q\), the number of queries. Each query is described over two lines: the first line contains an integer \(k\) (with \(0 \le k \le 15\)), denoting the number of edges to be removed; the second line contains \(k\) space-separated integers denoting the 1-indexed positions of the edges to delete. (If \(k = 0\), the second line is omitted.)
outputFormat
For each query, output a single line containing either "Yes" if the graph remains connected after the deletion of the specified edges, or "No" if it is disconnected.
sample
4 3
1 2
2 3
3 4
2
1
2
0
No
Yes
</p>