CODEVITA (TCS)
TCS CodeVita
CodeVita Round 1 2020 question Season 9
CodeVita :
Critical Planets
- Problem Description
War
between Republic and Separatist is escalating. The Separatist are on a new
offensive. They have started blocking the path between the republic planets
(represented by integers), so that these planets surrender due to the shortage
of food and supplies. The Jedi council has taken a note of the situation and
they have assigned Jedi Knight Skywalker and his Padawan Ahsoka to save the
critical planets from blockade (Those planets or system of planets which can be
accessed by only one path and may be lost if that path is blocked by
separatist).
Skywalker is preparing with the
clone army to defend the critical paths. He has assigned Ahsoka to find the
critical planets. Help Ahsoka to find the critical planets(C) in ascending
order. You only need to specify those planets which have only one path between
them and they cannot be accessed by any other alternative path if the only path
is compromised.
N <= 7000
First line contains two space
separated integers M and N, where M denotes the number of paths between planets
and N denotes the number of planets.
Next M lines, each contains two
space separated integers, representing the planet numbers that have a path
between them.
3 4
0 1
1 2
2 3
1
2
3
- Explanation
Since all the planets are connected
with one path and cannot be accessed by any alternative paths hence all the
planets are critical.
7 6
0 2
0 1
1 2
2 3
4 5
3 4
3 5
3
- Explanation
0 Comments