PDP-25 (2013) - Camp common - 1 (network)

View as PDF

Submit solution

Points: 30 (partial)
Time limit: 1.0s
Memory limit: 64M

Author:
Problem types
Allowed languages
C, C++, Java, Pascal, Python

NETWORK

A telecommunications company is planning a new telephone network. The network will connect N locations, numbered from 1 to N. The lines between the locations are bidirectional. From each location, one can call any other location, but the connection may not be direct and may pass through other intermediate locations acting as switches.

Sometimes, some locations experience power outages. When this happens, the locations cannot function either to make or receive calls or as switches. The company found that sometimes power outages cause connectivity issues between locations that still have power. A location is considered critical when, in the event of a power outage, there is at least one pair of other locations that can no longer connect to each other.

Write a program to find all critical locations in the network.

Input (network.in)

The first line of input will consist of two natural numbers N and K: the number of locations and the number of direct connections between them. Each of the next K lines will contain two numbers, defining the ends of a direct connection.

Output (network.out)

The output should consist of a single line containing only one natural number: the number of critical locations in the network.

Constraints

3 \le N \le 10.000
2 \le K \le 100.000
Time limit: 1 sec.
Memory limit: 64 MB.

Examples of Input - Output
1st

STDIN (network.in)

5 4
2 5
4 5
5 3
1 5

STDOUT (network.out)

1
2nd

STDIN (network.in)

6 5
3 2
2 1
2 5
5 4
6 5

STDOUT (network.out)

2

Explanation of the examples: In the first example, the only critical location is 5. In the second example, there are two critical locations, 2 and 5.


Comments

There are no comments at the moment.