P10075 [GDKOI2024 Junior] Cutting.
Description
Given an undirected connected graph with $n$ vertices and $m$ edges, it **can** have multiple edges but has no self-loops.
ymqOAO now has $k$ queries. In each query, if $c_i$ edges are deleted from the graph, determine whether the remaining graph is still connected.
Note: The queries are independent of each other. Deleting edges in one query will not affect later queries.
Notes:
- Connected graph: In a graph, any two vertices are connected by a path.
Input Format
The first line contains three integers $n, m$.
The next $m$ lines each contain two positive integers $x_i, y_i$, meaning that the $i$-th edge connects $x_i$ and $y_i$.
The next line contains an integer $k$, the number of queries.
The next $k$ lines describe the queries. In the $i$-th line, the first integer $c_i$ is the number of edges to be cut, followed by $c_i(1 \leq c_i \leq 4)$ integers giving the indices of the edges to be cut. The edge indices are in $[1, m]$.
Output Format
For each query, if the graph is not connected, output `Bob`; otherwise output `ymqOAO` (without quotes).
Explanation/Hint
Constraints:
- For $10\%$ of the testdata, $1 \leq m, n, k \leq 2000$.
- For another $10\%$ of the testdata, $m = n - 1$.
- For another $10\%$ of the testdata, $c_i = 1$.
- For $60\%$ of the testdata, $1 \leq m, n, k \leq 10^5$.
- For $100\%$ of the testdata, $1 \leq m, n, k \leq 10^6$.
Translated by ChatGPT 5