题面
每个点的答案等于 max(它的前驱节点答案+1)
具体实现:邻接表存储+拓扑排序+dp处理
不过貌似CCF数据过水,没有dp处理也可以过 ???
code
#include<bits/stdc++.h>
using namespace std;
int n,m,f[100005],ru[100005];
int cnt,fro[100005],nxt[200005],to[200005];
queue<int>q;
inline int read() {
int x=0; char c=getchar();
while(c<'0'||c>'9') c=<