您当前的位置: 首页 > 

先求一个导

暂无认证

  • 2浏览

    0关注

    291博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

2020ICPC澳门站 F(构的并不是很造)

先求一个导 发布时间:2022-03-31 21:08:43 ,浏览量:2

题目 题意: 给定n个点,每个点有d条有向边,要求构造出c个连通块。 思路: 在这里插入图片描述 时间复杂度: O(nd*log(nd)) 代码:

#include
using namespace std;
typedef long long ll;
const int N = 1e5+10;
int n,m,k,T;
int d,c;
int a[N];
void solve()
{
	scanf("%d%d%d",&n,&d,&c);
	ll t = c*(d+1);
	if(d == 0)
	{
		if(n == c)
		puts("Yes"); 
		else puts("No");
		return ;
	}
	if(d == 1)
	{
			if(n != 2*c)
			{
				puts("No");
				return ;
			}
			puts("Yes");
			int cnt = 1;
			for(int i=1;i n || (n&1)&&(d&1) )
	{
		puts("No");
	}
	else
	{
		puts("Yes");
		if(d % 2 == 0)
		{
			int dx;
			for(int i=0;i            
关注
打赏
1662037414
查看更多评论
0.0369s