[Solution] Qpwoeirut and Vertices Codeforces Solution
You are given a connected undirected graph with vertices and edges. Vertices of the graph are numbered by integers from to and edges of the graph are numbered by integers from to .
Your task is to answer queries, each consisting of two integers and . The answer to each query is the smallest non-negative integer such that the following condition holds:
- For all pairs of integers such that , vertices and are reachable from one another using only the first edges (that is, edges ).
The first line contains a single integer () — the number of test cases.
The first line of each test case contains three integers , , and (, ) — the
Solution Click Below:- 👉CLICK HERE
number of vertices, edges, and queries respectively.
Each of the next lines contains two integers and () — ends of the -th edge.
It is guaranteed that the graph is connected and there are no multiple edges or self-loops.
Another String Minimization Problem Codeforces Solution
Making Towers Codeforces Solution
Qpwoeirut And The City Codeforces Solution
Chopping Carrots (Easy Version) Codeforces Solution
Chopping Carrots (Hard Version) Codeforces Solution
Each of the next lines contains two integers and () — descriptions of the queries.
It is guaranteed that that the sum of over all test cases does not exceed , the sum of over all test cases does not exceed , and the sum of over all test cases does not exceed .
For each test case, print integers — the answers to the queries.
No comments:
Post a Comment