当前位置:网站首页>Motion Regulations (18) - and check the basic questions - gang
Motion Regulations (18) - and check the basic questions - gang
2022-08-04 12:33:00 【H_Cisco】
lives in a cityNPersonally, any two people who know each other are either friends or enemies, and are satisfied:
1, My friend's friend is my friend;
2, The enemy of my enemy is my friend;
All people who are friends form a gang.Tell you about thisNpersonalM pieces of information, that is, two people are friends, or two people are enemies, please write a program to calculate the city with the mostHow many gangs might there be?
Enter
The first line contains an integerN, the second line contains an integerM
NextMLine DescriptionM pieces of information, the content is one of the following two: "0 X Y" means XandYis a friend;"1 X Y" means X and Y is the enemy.
Output
Contains an integer, the maximum possible number of gangs.
Sample input
6 4
1 1 4
0 3 5
0 4 6
1 1 2
Sample output
3
边栏推荐
猜你喜欢

“蔚来杯“2022牛客暑期多校训练营2 G、J、K

Redis (1) installation and configuration

Small program on how to play in the construction of e-government service platform value

Practical sharing of distributed link tracking Jaeger + microservice Pig on Rainbond

推荐一款优秀的通用管理后台

“蔚来杯“2022牛客暑期多校训练营5 B、C、F、G、H、K

【黑马早报】尚乘数科上市13天,市值超阿里;北大终止陈春花聘用合同;新东方花近200亿退学费和遣散费;张小泉75%产品贴牌代工...

树莓派入门

【微信小程序】信息管理与信息系统专业社会实习制作项目--垃圾指纹

开发小程序插件如何实现盈利?
随机推荐
shell之循环语句(for、while、until)
A Survey of Multi-Label Classification under Supervised and Semi-Supervised Learning
罗振宇的A股梦,咋这么难圆?
Yolov5 test and train own dataset
用VbScript控制光驱
Do you understand the various configurations in the project?
来 TDengine 开发者大会,洞悉数据技术发展的未来趋势
FHQ-Treap 简介
考研数一数二数三之间的具体详细区别
Flutter强大的下拉筛选菜单gzx_dropdown_menu
年轻人为什么不喜欢买蒙牛、伊利了?
What is DevOps?Enough to read this one!
Js获取当前页面url参数
广告电商系统开发之订单处理
ECCV 2022 | Towards Data Efficient Transformer Object Detectors
如何治理资源浪费?百度云原生成本优化最佳实践
全面认识MOS管,一篇文章就够了
两个数组中用第二个数组的Value对比换第一个数组中的Key
动规(16)-并查集基础题——亲戚(Relations)
Access Huawei game anti-addiction, click the anti-addiction pop-up window, the game crashes