当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
UMA & Hong Kong Polytechnic & Ali propose SP-ViT to learn 2D space prior knowledge for visual Transformer!
技术分享| 融合调度系统中的电子围栏功能说明
如何做好企业数字化转型?这10份靠谱案例收藏了(附下载)
244 page PDF!"2022 China cloud computing ecological blue book published
Shell loop statement (for, while, until)
ECCV 2022 | 通往数据高效的Transformer目标检测器
分布式链路追踪Jaeger + 微服务Pig在Rainbond上的实践分享
企业应当实施的5个云安全管理策略
exness:美联储重现鹰派口吻,黄金承压面临转跌信号
第10章 模块和包
yolo系列的Neck模块
中电资讯 - 一路“标”升,喜迎Q3开门红
Chinese valentine's day of young people crazy to make money, earn 140000 a week
简要介绍电源效率测试
03 多线程与高并发 - ReentrantLock 源码解析
Cache character stream
AI 助力双碳目标:让每一度电都是我们优化的
开发小程序插件如何实现盈利?
MySQL索引原理以及SQL优化
面试官:连 INSERT INTO SET 都不知道怎么用,你这3年都干些什么了?