#K53532. Redundant Network Construction
Redundant Network Construction
Redundant Network Construction
In this problem, you are given a network of (n) houses and (m) pipes. Each pipe connects a pair of houses. Your task is to determine whether it is possible to build a network using the given pipes such that the network is initially connected and remains connected even if any one pipe fails. In other words, there should be at least one pipe that, if removed, the remaining network still remains fully connected. Note that a network is connected if there is a path between every pair of houses.
Formally, let the houses be indexed from (0) to (n-1). You are provided with (m) pipes where each pipe is represented by a tuple ((u,v)) indicating a bidirectional connection between house (u) and house (v). The network must satisfy the property that there exists at least one pipe ((u,v)) whose removal does not disconnect the network.
inputFormat
The input is given via standard input (stdin) in the following format:
The first line contains two integers (n) and (m) separated by a space, where (n) is the number of houses and (m) is the number of pipes.
The next (m) lines each contain two integers (u) and (v), representing a bidirectional pipe between houses (u) and (v).
outputFormat
Print a single line to standard output (stdout) containing either "YES" if it is possible to construct such a network, or "NO" if it is not possible.## sample
4 5
0 1
0 2
2 1
1 3
2 3
YES