当前位置:网站首页>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
边栏推荐
猜你喜欢

MySQL - Explain explanation

罗振宇的A股梦,咋这么难圆?

程序猿七夕礼物-如何30分钟给女友快速搭建专属语聊房

开发小程序插件如何实现盈利?

Hit the interview!The latest interview booklet of Ali Jin, nine silver and ten is stable!

DC-DC电源中前馈电容的选择

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

MySQL必知必会(初级篇)

Share | technology integration electronic fence function of scheduling system

干货丨数学规划视角下的分货优化解题思路
随机推荐
ECCV 2022 | 通往数据高效的Transformer目标检测器
Focus!2022 interview must brush 461 interview questions summary + interview + resume template
Do you understand the various configurations in the project?
缓存字符流
小程序在政务服务平台建设中如何发挥价值
LeetCode Daily Question (858. Mirror Reflection)
新消费、出海、大健康......电子烟寻找“避风港”
Cache character stream
博云入选 Gartner 中国 DevOps 代表厂商
Flutter 使用 json_serializable 解析 JSON 支持泛型
“蔚来杯“2022牛客暑期多校训练营2 G、J、K
绩效考核带给员工的不能只是压力
正则表达式
“蔚来杯“2022牛客暑期多校训练营3 C
DC/DC电感底部要不要覆铜?
图像分割方法
从数学角度和编码角度解释 熵、交叉熵、KL散度
酷开科技 × StarRocks:统一 OLAP 分析引擎,全面打造数字化的 OTT 模式
获取本机IP地址的脚本
WPF---Grid布局讲解