CF216B.Forming Teams

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

One day nn students come to the stadium. They want to play football, and for that they need to split into teams, the teams must have an equal number of people.

We know that this group of people has archenemies. Each student has at most two archenemies. Besides, if student AA is an archenemy to student BB , then student BB is an archenemy to student AA .

The students want to split so as no two archenemies were in one team. If splitting in the required manner is impossible, some students will have to sit on the bench.

Determine the minimum number of students you will have to send to the bench in order to form the two teams in the described manner and begin the game at last.

输入格式

The first line contains two integers nn and mm ( 2<=n<=1002<=n<=100 , 1<=m<=1001<=m<=100 ) — the number of students and the number of pairs of archenemies correspondingly.

Next mm lines describe enmity between students. Each enmity is described as two numbers aia_{i} and bib_{i} ( 1<=ai,bi<=n1<=a_{i},b_{i}<=n , aibia_{i}≠b_{i} ) — the indexes of the students who are enemies to each other. Each enmity occurs in the list exactly once. It is guaranteed that each student has no more than two archenemies.

You can consider the students indexed in some manner with distinct integers from 1 to nn .

输出格式

Print a single integer — the minimum number of students you will have to send to the bench in order to start the game.

输入输出样例

  • 输入#1

    5 4
    1 2
    2 4
    5 3
    1 4
    

    输出#1

    1
  • 输入#2

    6 2
    1 4
    3 4
    

    输出#2

    0
  • 输入#3

    6 6
    1 2
    2 3
    3 1
    4 5
    5 6
    6 4
    

    输出#3

    2
首页