This page is still under construction.

Parts of this page are still being built. What you see may change.

Graph Maximum Matching

Interview

Time limit2sMemory limit512 MB

Summary
Given a small graph, decide whether some edges can be kept so every vertex has degree exactly 1.
Level

Easy2 of 10

Topics
Graph, Backtracking, Greedy
Solved
No attempts yet

Problem

An undirected graph has NN vertices and MM edges.

Write a program that decides whether you can delete some of the edges so that every vertex has degree exactly 11.

Input

The first line contains NN and MM. (2≤N≤1002 \le N \le 100, 1≤M≤1001 \le M \le 100)

Each of the next MM lines describes one edge and contains the numbers of the two vertices it joins.

Two vertices can be joined by more than one edge. There are no loops. Vertex numbers run from 11 to NN.

Output

Print 11 if deleting some edges can make every vertex have degree 11, and 00 otherwise.

Examples3

  1. Example 1

    Input
    2 2
    1 2
    1 2
    
    Expected output
    1
    
  2. Example 2

    Input
    3 2
    1 2
    2 3
    
    Expected output
    0
    
  3. Example 3

    Input
    4 6
    1 2
    1 3
    1 4
    2 3
    2 4
    3 4
    
    Expected output
    1