All Tracks Algorithms Graphs Graph Representation Problem

Build a graph
/

Algorithms, Graphs

Problem
Editorial
Analytics

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:

  1. Its degree is less than or equal to 1.
  2. 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\)

SAMPLE INPUT
3
SAMPLE OUTPUT
No
Explanation

There is only one graph with the number of edges equal to the number of vertices (triangle) which is connected.

Time Limit: 0.5 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB

Best Submission

Similar Problems

Contributors

This Problem was Asked in

Initializing Code Editor...
Notifications
View All Notifications

?