#C1634. Bipartite Graph Check

    ID: 44861 Type: Default 1000ms 256MiB

Bipartite Graph Check

Bipartite Graph Check

This problem asks you to determine whether a given undirected graph is bipartite. A graph is bipartite if its vertices can be divided into two disjoint sets such that no two vertices within the same set share an edge.

You are given a graph in the following format through standard input. Your task is to output True if the graph is bipartite and False otherwise.

Note: An empty graph (with 0 vertices) is considered bipartite.

inputFormat

The first line contains two integers n and m — the number of vertices and the number of edges respectively. Each of the following m lines contains two integers u and v describing an undirected edge between the vertices u and v (0-indexed).

outputFormat

Output a single line: True if the graph is bipartite, otherwise False.## sample

4 4
0 1
0 3
1 2
2 3
True