/ SB域 /

记录详情

Wrong Answer

/in/foo.cc: In function 'int main()':
/in/foo.cc:49:4: warning: statement has no effect [-Wunused-value]
   k==0; 
   ~^~~
/in/foo.cc:56:5: warning: statement has no effect [-Wunused-value]
   k1==0; 
   ~~^~~
# 状态 耗时 内存占用
#1 Accepted 2ms 2.734 MiB
#2 Wrong Answer 10ms 4.637 MiB
#3 Accepted 2ms 4.32 MiB
#4 Wrong Answer 3ms 4.574 MiB
#5 Wrong Answer 2ms 2.328 MiB
#6 Wrong Answer 5ms 2.699 MiB
#7 Wrong Answer 2ms 2.324 MiB
#8 Wrong Answer 3ms 4.328 MiB
#9 Wrong Answer 3ms 4.547 MiB
#10 Wrong Answer 3ms 4.578 MiB

代码

#include<bits/stdc++.h>
using namespace std;
int mmap[2005][2005],mmap1[2005][2005]; ; 
int vis[2005],vis1[2005];
int k,k1,n,m,ans;
void dfs(int now)
{
	
	vis[now]=1;
	for(int i=1;i<=n;i++)
	{
		if(mmap[now][i]&&vis[i]==0)
		{
			k++;
			dfs(i);
		}
	}
	
}
void dfs1(int now)
{
	
	vis1[now]=1;
	for(int i=1;i<=n;i++)
	{
		if(mmap1[now][i]&&vis1[i]==0)
		{
			k++;
			dfs1(i);
		}
	}
	
}
int main()
{
	cin>>n>>m;
	for(int i=1;i<=m;i++)
	{
		int x,y;
		cin>>x>>y;
		mmap[x][y]=1;
		mmap1[y][x]=1;
	}
	for(int i=1;i<=n;i++)
	{
		memset(vis,0,sizeof(vis));
		dfs(i);	
		if(k>=(n+1)/2) ans++;
		k==0;	
	}
	for(int i=1;i<=n;i++)
	{
		memset(vis1,0,sizeof(vis1));
		dfs1(i);	
		if(k1>=(n+1)/2) ans++;
		k1==0;	
	}
	 cout<<ans;   
}

信息

递交者
类型
递交
题目
珍珠
题目数据
下载
语言
C++
递交时间
2019-03-25 10:14:22
评测时间
2019-03-25 10:14:22
评测机
分数
20
总耗时
40ms
峰值内存
4.637 MiB