我编译时出现了这样的图案:
出了啥问题!我该怎么办!
呈上代码:
#include<bits/stdc++.h>
using namespace std;
int n,m,A,B,maxx,prot[5005];
vector<int>G[5005];
void dfs(int dot,int step){
step++;
maxx=max(maxx,step);
for(int i=0;i<=G[dot].size();i++)dfs(G[dot][i],step);
}
int main(){
memset(prot,1,sizeof(prot))
cin>>n>>m;
while(m--){
cin>>A>>B;
G[A].push_back(B);
}
for(int i=1;i<=n;i++)for(int j=0;j<G[i].size();j++)pro[G[i][j]]=0;
for(int i=1;i<=n;i++)if(prot[i])dfs(i,0);
cout<<maxx;
return 0;
}