QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 128 MB مجموع النقاط: 100

#16028. Magical Kingdom

الإحصائيات

If you were asked which shape you like best—a square, a circle, or a hexagon—what would you choose? The citizens of Kingdom K would give a unanimous answer: the triangle. Yes, Kingdom K is such a magical land, and they have a special fondness for triangles: the beauty of the triangle is reflected everywhere in their culture, whether in literature, art, or architecture. Even in interpersonal relationships, the citizens of Kingdom K adhere to the "Triangle Principle": they believe that a relationship where three people all know each other (i.e., A knows B, B knows C, and C knows A) is simple and efficient, and they call this a "triangular relationship." To consolidate the status of "triangular relationships" in social interactions, Kingdom K prohibits "quadrilateral relationships," "pentagonal relationships," and any "N-sided relationship" ($N > 3$). An "N-sided relationship" refers to a situation where, among N people $a_1, a_2, \dots, a_N$, the only friendships are between $a_1$ and $a_2$, $a_2$ and $a_3$, $\dots$, $a_{N-1}$ and $a_N$, and $a_N$ and $a_1$, with no other pairs knowing each other. For example, a "quadrilateral relationship" refers to four people A, B, C, and D, such that A and B know each other, B and C know each other, C and D know each other, and D and A know each other, while A and C do not know each other, and B and D do not know each other.

Kingdom K has an ancient custom: every summer, a national competition is held, and all citizens of Kingdom K must participate. The rules of the competition change every year, and citizens are free to form teams to participate, with no limit on the number of people per team. However, in recent years, cheating has occurred frequently on the competition field, so the King has decided to prohibit any two people who know each other from being on the same team. In other words, only people who do not know each other can be assigned to the same team. However, this might lead to too many teams, making it take a long time to complete the entire competition. Therefore, the King wants to know the minimum number of teams required to hold the competition such that no two members on the same team know each other.

Input

The first line contains two integers separated by a space: the first integer represents the total number of people in Kingdom K, $n$, and the second integer $m$ represents the number of pairs of friends among these people. Here, $1 \le n \le 10000$ and $1 \le m \le 10^6$.

The next $m$ lines each contain two integers $a_i$ and $b_i$ separated by a space, where $1 \le a_i, b_i \le n$ and $a_i \ne b_i$, indicating that $a_i$ and $b_i$ are a pair of friends. The input data guarantees that each friendship pair appears only once.

Output

Contains only one integer, representing the minimum number of teams required to hold the competition such that no two members on the same team know each other.

Examples

Input 1

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

Output 1

3

Note 1

One possible solution is: person 1 and person 3 form one team, person 2 forms a team alone, and person 4 forms a team alone.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.