-->
当前位置:首页 > 题库

PROGRAMMING:Red Alert

Luz5年前 (2021-05-10)题库406
It is very important to maintain the connectivity between cities in the war. This problem requires you to write an alarm program, when the loss of a city causes the country to be divided into many disconnected areas, the red alarm will be issued. Note: if the country is not completely connected and is divided into k regions, and the loss of one city does not change the connectivity between other cities, do not give an alarm.
###Input format:
Enter two integers' n '(0 $$< $$n' $$Le $$500) and'm '($$Le $$5000) in the first line, which are the number of cities (so the default city number is from 0 to' n '- 1) and the number of access roads connecting the two cities. Next, the'm 'line gives the numbers of the two cities connected by one access road, separated by a space. After the city information, the occupied information is given, that is, a positive integer 'k' and the subsequent 'k' numbers of the occupied cities.
Note: the input guarantees that the number of the occupied city given is legal and has no repetition, but it does not guarantee that the given path has no repetition.
###Output format:
For each captured City, if it will change the connectivity of the whole country, output "Red Alert: City K is lost!", Where 'k' is the number of the city; Otherwise, only output 'City K is lost.'. If the country loses its last city, add a line to output "game over.".
###Input example:
```in
5 4
0 1
1 3
3 0
0 4
five
1 2 0 4 3
```
###Output example:
```out
City 1 is lost.
City 2 is lost.
Red Alert: City 0 is lost!
City 4 is lost.
City 3 is lost.
Game Over.
```






answer:If there is no answer, please comment