#P10075. [GDKOI2024 普及组] 切割

[GDKOI2024 普及组] 切割

Problem Description

Given an undirected connected graph with nn vertices and mm edges, it can have multiple edges but has no self-loops.

ymqOAO now has kk queries. In each query, if cic_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,mn, m.

The next mm lines each contain two positive integers xi,yix_i, y_i, meaning that the ii-th edge connects xix_i and yiy_i.

The next line contains an integer kk, the number of queries.

The next kk lines describe the queries. In the ii-th line, the first integer cic_i is the number of edges to be cut, followed by ci(1ci4)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][1, m].

Output Format

For each query, if the graph is not connected, output Bob; otherwise output ymqOAO (without quotes).

4 5
1 2
2 3
3 4
4 1
2 4
3
1 5
2 2 3
2 1 2
ymqOAO
Bob
ymqOAO

Hint

Constraints:

  • For 10%10\% of the testdata, 1m,n,k20001 \leq m, n, k \leq 2000.
  • For another 10%10\% of the testdata, m=n1m = n - 1.
  • For another 10%10\% of the testdata, ci=1c_i = 1.
  • For 60%60\% of the testdata, 1m,n,k1051 \leq m, n, k \leq 10^5.
  • For 100%100\% of the testdata, 1m,n,k1061 \leq m, n, k \leq 10^6.

Translated by ChatGPT 5