Gửi bài giải

Điểm: 1,00 (OI)
Giới hạn thời gian: 1.0s
Giới hạn bộ nhớ: 256M
Input: stdin
Output: stdout

Nguồn bài:
Hà Minh Ngọc
Dạng bài
Ngôn ngữ cho phép
C, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch

ABC company has ~n~ employees numbered from ~0~. Each employee is managed by up to ~1~ other employee and has no cross-management (No trio exists: ~A~ manages ~B~, ~B~ manages ~C~, ~C~ manager ~A~). The company wants to organize travel for its employees but the staff does not want to go with their superiors (the direct manager or higher) because they feel uncomfortable. The company will need to organize at least how many groups so there are no employees and superiors in the same group. Note that the company has a director, not managed by any other employee.

Input

  • The first line contains the number of employees ~n, m (0 ≤ n, m ≤ 10^5)~ the number of employees and the number of management relationships.
  • The next ~m~ lines contain two integers ~u, v~ representing ~u~ as a direct manager of ~v~.

Output

  • Minimum number of groups.

Example Input

5 4
2 4
4 1
3 2
3 0

Example Output

4

Bình luận

Hãy đọc nội quy trước khi bình luận.


Không có bình luận tại thời điểm này.