求助:我的编译发生了什么!!
  • 板块灌水区
  • 楼主nzsb
  • 当前回复18
  • 已保存回复18
  • 发布时间2022/3/17 19:36
  • 上次更新2023/10/28 06:22:29
查看原帖
求助:我的编译发生了什么!!
467504
nzsb楼主2022/3/17 19:36

我编译时出现了这样的图案:https://cdn.luogu.com.cn/upload/image_hosting/n0pcob4w.png 出了啥问题!我该怎么办!

呈上代码:

#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;
}
2022/3/17 19:36
加载中...