AT_dp_g Longest Path

Description

[problemUrl]: https://atcoder.jp/contests/dp/tasks/dp_g $ N $ 頂点 $ M $ 辺の有向グラフ $ G $ があります。 頂点には $ 1,\ 2,\ \ldots,\ N $ と番号が振られています。 各 $ i $ ($ 1\ \leq\ i\ \leq\ M $) について、$ i $ 番目の有向辺は頂点 $ x_i $ から $ y_i $ へ張られています。 $ G $ は**有向閉路を含みません**。 $ G $ の有向パスのうち、最長のものの長さを求めてください。 ただし、有向パスの長さとは、有向パスに含まれる辺の本数のことです。

Input Format

N/A

Output Format

N/A

Explanation/Hint

### 制約 - 入力はすべて整数である。 - $ 2\ \leq\ N\ \leq\ 10^5 $ - $ 1\ \leq\ M\ \leq\ 10^5 $ - $ 1\ \leq\ x_i,\ y_i\ \leq\ N $ - ペア $ (x_i,\ y_i) $ はすべて相異なる。 - $ G $ は**有向閉路を含まない**。 ### Sample Explanation 1 次図の赤い有向パスが最長です。 ![](https://img.atcoder.jp/dp/longest_0_muffet.png) ### Sample Explanation 2 次図の赤い有向パスが最長です。 ![](https://img.atcoder.jp/dp/longest_1_muffet.png) ### Sample Explanation 3 例えば、次図の赤い有向パスが最長です。 ![](https://img.atcoder.jp/dp/longest_2_muffet.png)