网站首页
编程语言
数据库
系统相关
其他分享
编程问答
CF771A
2024-10-26
CF771A. Bear and Friendship Condition 题解 并查集
题目链接:https://codeforces.com/problemset/problem/771/A视频讲解:https://www.bilibili.com/video/BV1tZ1FYPELp/?p=6题目大意:判断一个无向图中的每个连通块是否都是一个完全图。首先我们可以用并查集维护每个连通块的大小。其次,我们可以开一个\(cnt_i\)表示以节点\(i\)