/ Randle /

记录详情

Runtime Error


  
# 状态 耗时 内存占用
#1 Wrong Answer 1ms 200.0 KiB
#2 Wrong Answer 1ms 204.0 KiB
#3 Wrong Answer 1ms 212.0 KiB
#4 Accepted 1ms 204.0 KiB
#5 Wrong Answer 11ms 4.781 MiB
#6 Wrong Answer 17ms 13.504 MiB
#7 Wrong Answer 102ms 13.273 MiB
#8 Wrong Answer 74ms 13.07 MiB
#9 Runtime Error 1ms 196.0 KiB
#10 Runtime Error 1ms 200.0 KiB

代码

#include <bits/stdc++.h>
using namespace std;
struct xxx
{
	int x,y,z;
}f[10000005];
int n;
int main()
{
//    freopen("card.in","r",stdin);
//    freopen("card.out","w",stdout);
	int x,y;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d %d",&x,&y);
		f[x].x++;
		f[y].x++;
		f[x].y++;
	}
	int m=(n+1)/2,b=0;
	for(int i=1;i<=n;i++)
	{
		if(f[i].x>=m)
		  b=1;
	}
	if(b==0)
	{
	  printf("Impossible");
      return 0;
	}
	int minn=1e9;
	for(int i=1;i<=n;i++)
	{
		if(f[i].x>=m)
		  f[i].z=m-f[i].y;
		else
		  f[i].z=1e9;
		minn=min(minn,f[i].z);
//		cout<<f[i].x<<' '<<f[i].y<<' '<<f[i].z<<endl;
	}
	printf("%d",minn);
	return 0;
}

信息

递交者
类型
递交
题目
纸牌
题目数据
下载
语言
C++
递交时间
2019-12-13 15:20:38
评测时间
2019-12-13 15:20:38
评测机
分数
10
总耗时
215ms
峰值内存
13.504 MiB