POJ 1611 The Suspects

NanoTrack 模型从 PyTorch 到 RK3588 的 RKNN 转换与部署实战 模型转换是将训练框架计算图翻译为 NPU 可执行指令的关键环节,涉及算子映射、动态 shape 处理和量化校准等核心技术。在边缘计算场景中,RK3588 凭借 6 TOPS NPU 算力成为部署轻量级跟踪模型的热门平台,而 NanoTrack 作为高效单目标跟踪网络,其 PyTorch 到 RKNN 的迁移过程需要经过 ONNX 中间格式桥接,并解决算子兼容性与 INT8 量化精度问题。该流程广泛应用于智能安防、无人机图传等实时跟踪场景,通过合理的校准集构建与混合量化策略,可在板端实现 60 FPS 以上的 阅读详情

The Suspects

https://vjudge.net/problem/POJ-1611
Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to separate the suspects from others.
In the Not-Spreading-Your-Sickness University (NSYSU), there are many student groups. Students in the same group intercommunicate with each other frequently, and a student may join several groups. To prevent the possible transmissions of SARS, the NSYSU collects the member lists of all student groups, and makes the following rule in their standard operation procedure (SOP).
Once a member in a group is a suspect, all members in the group are suspects.
However, they find that it is not easy to identify all the suspects when a student is recognized as a suspect. Your job is to write a program which finds all the suspects.
Input
The input file contains several cases. Each test case begins with two integers n and m in a line, where n is the number of students, and m is the number of groups. You may assume that 0 < n <= 30000 and 0 <= m <= 500. Every student is numbered by a unique integer between 0 and n−1, and initially student 0 is recognized as a suspect in all the cases. This line is followed by m member lists of the groups, one line per group. Each line begins with an integer k by itself representing the number of members in the group. Following the number of members, there are k integers representing the students in this group. All the integers in a line are separated by at least one space.
A case with n = 0 and m = 0 indicates the end of the input, and need not be processed.
Output
For each case, output the number of suspects in one line.
Sample Input
100 4
2 1 2
5 10 13 11 12 14
2 0 1
2 99 2
200 2
1 5
5 1 2 3 4 5
1 0
0 0
Sample Output
4
1
1
C++

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

const int MAXN = 30000 + 10;
int fa[MAXN], sum[MAXN];
int n, m;

void init()
{
	for(int i = 0; i < n; i ++)
		fa[i] = i, sum[i] = 1;
}

int find(int x)
{
	if(fa[x] == x) return x;
	return fa[x] = find(fa[x]);
}

void merge(int x, int y)
{
	int tx = find(x);
	int ty = find(y);
	if(tx != ty)
		fa[tx] = ty, sum[ty] += sum[tx];
}

int main()
{
	while(scanf("%d%d", &n, &m) != EOF)
	{
		if(n == 0 && m == 0) break;
		init();
		int t, a, b;
		for(int i = 0; i < m; i ++)
		{
			scanf("%d", &t);
			scanf("%d", &a);
			for(int j = 1; j < t; j ++)
			{
				scanf("%d", &b);
				merge(a, b);
			}
		}
		printf("%d\n", sum[find(0)]);
	}
	return 0;
}
储能BMS三级架构解析:从模组到堆的管理与控制 本文深入解析了储能电池管理系统(BMS)的核心三级架构,即电池模组管理层(BMU)、电池簇管理层(BCMU)和电池堆管理层(BAMS)。文章详细阐述了各级的职能分工与协同机制,从底层数据采集、均衡管理,到中层信息汇总与安全控制,再到顶层的系统总控与对外通信,揭示了该架构如何实现大规模储能电池的精细化、安全与高效管理。 阅读详情

相关推荐

PCIe学习笔记(一)-------1.3 PCIe数据包(TLP,DLLP,PLP)

1,PCIe的层次结构 PICe设备在硬件电路上可以分为三个层次结构:事务层(Transaction Layer)、数据链路层(Data Link Layer)、物理层(Physical)。每一个层次又可以分为两个部分,分别为处理发送和处理接收的部分。 也可以分为四个层次,将事务层以上的层次称为软件层(Software Layer)。 2,PCIe数据包 前面已经说过PCIe之间是以数据包的形式来传输数据的,协议共定义了3类数据包。与处理层相关的是处理层数据包(TLP),与数据链路层相关的是数据

llxxyy507的博客 2万+

poj 1611 The Suspects

http://poj.org/problem?id=1611 The Suspects Time Limit:1000MS     Memory Limit:20000KB     64bit IO Format:%I64d & %I64u Submit Status Description Severe acute respiratory s

大太阳 475

【中软软件测试笔试题】中国软件与技术服务股份有限公司笔试一卷

请分别写出ISO7层架构,并分别说明TCP、UDP协议分别在处于哪一层,以及TCP、 UPD协议有什么区别。 答:7 应用层 6 表示层 5 会话层 4 传输层 3网络层 2 数据链路层 1 物理层 第四层;UDP是面向无连接、不可靠数据传输协议; TCP是面向连接、可靠数据传输协议......

Yanan990830的博客 1815

POJ - 1611The Suspects-并查集

POJ - 1611 The Suspects Time Limit: 1000MS   Memory Limit: 20000KB   64bit IO Format: %I64d & %I64u Submit Status Description 严重急性呼吸系统综合症( SARS), 一种原因不明的非典型性肺炎,从2003年3

qq_18661257的专栏 1014

项目经理面试 5 大高频题 + 实战回答模板,帮你稳拿 offer

项目经理面试5大高频问题及应答技巧 摘要:本文总结了项目经理岗位常见的5个面试问题及回答策略,帮助求职者更有针对性地准备面试。核心问题包括:1)描述负责过的典型项目;2)常用项目管理工具;3)项目遇到的挑战及解决方案;4)风险管理方法;5)项目成功标准。每个问题都从面试官考察重点、回答技巧、实战案例三个维度进行分析,强调要用STAR法则(情境-任务-行动-结果)结构化表达,突出解决问题的能力而非简单罗列经历。特别提醒要量化项目成果(如提前2周上线、节省8%预算等),并注意展示商业思维和团队协作能力。

逸尘谈PM 2105

绕过Google Play:获取Expo Go安卓APK的实用指南

本文为国内安卓开发者提供了绕过Google Play商店获取Expo Go APK的实用指南。针对无法访问Google Play的痛点,详细介绍了通过官方GitHub Releases、可信第三方网站(如APKMirror)及APK下载器等多种安全获取途径,并重点讲解了APK安装、安全验证(核对签名)及常见连接问题的排查方法,帮助开发者顺利开启React Native开发之旅。

weixin_29006701的博客 577

【并查集-size[ ]】POJ 1611 The Suspects

POJ 1611 The Suspects #include <iostream> #include <cstdio> #include <algorithm> #include <queue> #include <cmath> #include <cstring> #include <string> #inclu...

L_X_ 145

STM32F103多通道PWM输出避坑指南:TIM1_CH1异常输出的解决方案

本文深入解析STM32F103多通道PWM输出中的TIM1_CH1异常问题,提供从时钟配置到GPIO复用的系统化解决方案。通过黄金法则配置流程和高级调试技巧,帮助开发者快速定位并解决PWM输出不稳定、占空比异常等问题,同时拓展多定时器协同和互补PWM等高级应用场景。

weixin_29194817的博客 117

poj1611 The Suspects

poj1611 The Suspects 时空限制    1000ms/128MB Description Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To m...

H优快云 312

9.9元ESP32-C3开发板实战:手把手教你用VSCode搭建RT-Thread最小系统(附避坑指南)

本文提供了一份详尽的实战指南,教你如何在售价仅9.9元的ESP32-C3开发板上,使用VSCode搭建RT-Thread最小系统。内容涵盖从ESP-IDF环境配置、BSP源码获取、内核补丁应用到编译下载与调试的全流程,并重点分享了版本选择、补丁应用等关键避坑技巧,旨在帮助开发者低成本、高效地启动嵌入式实时操作系统开发。

o4p5q6r7s的博客 226

【K8S系列】Kubernetes 中 Pod 无法通过 Service 名称访问服务的 DNS 解析失败问题【已解决】

在 Kubernetes 中,Service 提供了一种稳定的方式,通过名称访问一组 Pod。当其他 Pod 无法通过 Service 名称访问服务,并且出现 DNS 解析失败时,通常会导致应用无法正常工作。本文将详细分析此问题的常见原因及其解决方案。

颜淡慕潇 1万+

kuangbin 并查集 - POJ - 1611 The Suspects (并查集模板题)

kuangbin 并查集 - POJ - 1611 The Suspects (并查集模板题) 传送门 Click here ~~ 题意: 小明被确诊了非典病毒,小明必须被隔离治疗,并且与他直接或间接接触者都要隔离观察。同一个社团内如果有人感染病毒或可能感染病毒,那么这个社团内所有人都被认为是可能已经感染了病毒,由于时间紧迫,需要尽快找到所有可能携带病毒的同学并隔离,以防止更大范围的病毒扩散,院长请你帮忙编写程序计算需要隔离多少人。 题解:模板题。 Click here ~~~ 可以看一下这个并查集模板

ACM-ICPC 现役(铜牌) Codeforces Rating: 2172 257

【瑞芯微px30】【RTL8363】【一】驱动移植-网卡驱动概述

linux rtl8363驱动移植

weixin_34799243的博客 1180

poj union_find相关之1611 The Suspects

poj union-find 1611 The Suspects

ziqi9216的博客 295

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

The Suspects POJ - 1611【并查集】

The Suspects POJ - 1611 题目 思路:并查集模板题,开一个cnt数组维护集合中点的数量,最后输出0号点所在集合中点的数量就可以了 具体代码如下 #include<iostream> #include<cstring> #include<cstdio> using namespace std; const int N = 30010; int n, m; int p[N], cnt[N]; int group[N]; int find(int

qq_50702668的博客 141

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

POJ - 1611 The Suspects (并查集)

题目链接:http://poj.org/problem?id=1611点击打开链接 The Suspects Time Limit: 1000MS   Memory Limit: 20000K Total Submissions: 39369   Accepted: 19056 Description Sever

xuejye的博客 290

【POJ】1611 The Suspects

题目链接:http://poj.org/problem?id=1611 题意:有学生感染了SARS。一个学生可以加入很多小组。n个学生m个小组,每个小组有k个组内成员,后跟着k个成员的组内编号。让你求出有多少学生受到了感染。 题解:并查集板子题。就是计数那里要注意。 代码: 1 #include<iostream> 2 #include&l...

deze1991的专栏 157

POJ.1611 The Suspects (并查集)

POJ.1611 The Suspects (并查集)题意分析对于每组测试数据: 这个学校有n个人,m小组,依次给出m个小组的信息,每行一个小组。 每个小组的信息包括,k,表示有k个人,k个数字,分别是这k个人的ID。 现在ID为0的人感染了病毒,他及他的小组成员全部会感染病毒,每个小组成员都会感染自己所在小组的成员(每个成员可以加入多个小组)。问现在总共有多少个人感染了病毒? 比较裸的并查

Pengwill's Blog 300

The Suspects||POJ1611

题目链接:http://poj.org/problem?id=1611 The SuspectsTime Limit: 1000MS Memory Limit: 20000K Total Submissions: 40525 Accepted: 19575 DescriptionSevere acute respiratory syndrome (SARS), an aty

csdn_muxin的博客 274

【解题报告】 POJ 1611 The Suspects 并查集基础 (一点自己的感悟)

题目连接:POJ 1611 最最基础的并查集题目,我就不说什么了。 // POJ1611 The Suspects 并查集 //初始化 所有点的父节点初始为-1 //查找(找到两点的祖先),合并(合并两个点的祖先) //由于我们事先开了数组记录了祖先的所有所有结点数(办法是进来一个新的结点,则num[祖先]+=num[新节点]) // //还有我感觉并查集有点类似于 皇帝->大臣->县令->师

生命有一种绝对 694

POJ - 1611 The Suspects(并查集)

POJ - 1611 The Suspects 思路:0是传染源,问和0有关系的数字有多少个,直接或者间接 #include<iostream> #include<cstdio> using namespace std; int a[30010],f[30010],book[30010]; int find(int x){return f[x]==x?x:f[x]=find(f[x]);} void merge(int v,int u) { int x=find(v); int

00后的博客 173

POJ 1611 The Suspects 【并查集基础】

POJ 1611 The Suspects 题目大意: 有n个人,m个社团,有一种病毒具有传染性,假设一个人可能感染,那么它所属社团的所有人都可能感染, 假设0号这个人疑似感染了病毒,问总共有多少人可能感染病毒 具体思路: 并查集模板题 具体代码: #include<iostream> #include<cstdio> #include<algorithm> u...

指弹键盘哼民谣 559

(POJ - 1611)The Suspects

(POJ - 1611)The SuspectsSevere acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best st

The wind of freedom blows 240

POJ 1611 The Suspects (并查集)

链接:http://poj.org/problem?id=1611 The Suspects Time Limit: 1000MS   Memory Limit: 20000K Total Submissions: 20031   Accepted: 9730 Description Severe acute respira

Epic丶玖遇 896
上一篇: POJ 2236 Wireless Network
下一篇: HDU 1213 How Many Tables
剑气扬名
博客等级 码龄7年 24粉丝 79原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值