#P3196. [HNOI2008] 神奇的国度

    ID: 2245 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>2008湖南广度优先搜索,BFS哈希,HASH

[HNOI2008] 神奇的国度

Description

Country K is obsessed with triangles; even interpersonal relationships follow a triangle principle. They consider a triangle relationship—namely, ABA B, BCB C, and CAC A are mutually acquainted—to be simple and efficient. To reinforce triangle relationships, Country K forbids the existence of four-cycle relationships, five-cycle relationships, and so on.

An NN-cycle relationship means that among NN people A1,A2,,AnA_1, A_2, \ldots, A_n, there exist exactly NN acquaintance pairs: (A1,A2)(A_1, A_2), (A2,A3)(A_2, A_3), \ldots, (An,A1)(A_n, A_1), and no other acquaintance pairs among them. For example, a four-cycle relationship means that among A,B,C,DA, B, C, D, the pairs (A,B)(A, B), (B,C)(B, C), (C,D)(C, D), (D,A)(D, A) are mutually acquainted, while (A,C)(A, C) and (B,D)(B, D) are not acquainted.

During a national contest, to prevent cheating, it is required that any two people who are acquainted must not be placed on the same team. The king wants to know the minimum number of teams needed.

Input Format

The first line contains two integers NN and MM (1N100001 \le N \le 10000, 1M10000001 \le M \le 1000000), indicating there are NN people and MM acquaintance pairs. The next MM lines each contain one pair of friends.

Output Format

Output a single integer: the minimum number of teams.

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

Hint

One possible arrangement: (1, 3) (2) (4).

Translated by ChatGPT 5