Build a graph
Algorithms
Graphs
91.0% success
16,142 attempts
0.5s time
256MB memory
1024KB max code
You are given an integer \(n\). Determine if there is an unconnected graph with \(n\) vertices that contains at least two connected components and contains the number of edges that is equal to the number of vertices. Each vertex must follow one of these conditions:
- Its degree is less than or equal to 1.
- It's a cut-vertex.
Note
- The graph must be simple.
- Loops and multiple edges are not allowed.
Input format
- First line: \(n\)
Output format
Print Yes if it is an unconnected graph. Otherwise, print No.
Constraints
\(1\le n\le100\)
Examples
Input
3
Output
No
Explanation
There is only one graph with the number of edges equal to the number of vertices (triangle) which is connected.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Loading Editor...