您当前的位置: 首页 > 

*DDL_GzmBlog

暂无认证

  • 1浏览

    0关注

    605博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

[Acwing] 1118.分出互质组 dfs分组问题

*DDL_GzmBlog 发布时间:2021-11-11 10:33:31 ,浏览量:1

前言

好像这个叫组内最大团 ? 传送门 :

思路

d f s dfs dfs分析当前节点

  • 新开一组,放到新的组里
  • 使用之前开过的组

因此我们直接按照题意DFS即可 (怎么说呢?

CODE
bool check(int g[],int gc,int num)
{
	for(int i = 0 ;i1)
		return false;
		return true;
}

void dfs(int g,int gc,int tc,int start)
{
	if(g>=ans)
	return;
	if(tc == n)
	ans = g;
	
	bool flag = true;
	
	for(int i =start;i>n;
	ans = n ;
	
	for(int i = 0;i>p[i];
	dfs(1,0,0,0);
	
	cout            
关注
打赏
1657615554
查看更多评论
0.0385s