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;
}
电容式麦克风:从原理到实际电路波形解析 本文深入解析电容式麦克风的工作原理,从核心的振膜与背板结构、电荷锁定机制到场效应管放大器的作用。通过实物拆解与等效电路分析,阐明声音振动如何转换为电压信号,并指导如何用示波器实测波形,直观展现声电转换过程,适合电子爱好者和音频技术学习者。 阅读详情

相关推荐

瑞芯微RK3576上手实测:8nm新U配6TOPS NPU,做AIoT项目选它还是RK3588/RK3568?

本文深度评测瑞芯微RK3576芯片在中高端AIoT项目中的表现,对比RK3588和RK3568的性能差异。RK3576采用8nm工艺,配备6TOPS NPU,在解码能力、AI推理效率和功耗控制方面表现均衡,是中端项目的黄金选择。实测数据显示其在多路视频解码和AI加速性能上优势明显,特别适合智能摄像头和工业HMI设备。

weixin_42627853的博客 716

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

vivado实现SDI接口

XAPP1249,用来介绍UHD_SDI的实现。

Huskar_Liu的博客 7076

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

宝骏kiwi 630 730 560 E100 E200 E300 310 510 610 330 530维修手册电路图资料线路图接线图更新

2020-2022年宝骏RS-3维修手册和电路图。2020-2022年宝骏RS-3维修手册和电路图。2019-2021年宝骏RC-6维修手册和电路图。2019-2021年宝骏RC-6维修手册和电路图。2019-2020年宝骏RS-5维修手册和电路图。2019-2020年宝骏RS-5维修手册和电路图。2019-2020年宝骏RM-5维修手册和电路图。2019-2020年宝骏RM-5维修手册和电路图。2019-2021年宝骏510维修手册和电路图。2019-2021年宝骏510维修手册和电路图。

weixin_45821055的博客 1771

STM32F405实战:手把手教你实现永磁同步电机无感FOC控制(附完整工程文件)

本文详细介绍了基于STM32F405微控制器实现永磁同步电机无感FOC控制的完整实战方案。文章从硬件搭建、CubeMX配置入手,逐步讲解了FOC核心算法、SVPWM调制,并重点阐述了如何结合HFI高频方波注入与滑模观测器(SMO)实现全速域无感控制。内容涵盖算法原理、代码实现、参数整定及调试技巧,并附有完整工程文件,为开发者提供从理论到实践的全面指导。

sun99的博客 265

【并查集-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

从Power到HO:一文搞懂主流脑图谱在DPABI里怎么选,让你的rs-fMRI分析更精准

本文深入解析了rs-fMRI分析中主流脑图谱(如Power、HO、AAL等)在DPABI中的科学选择策略,帮助研究者根据不同的神经科学研究目标优化分析流程。从解剖学图谱到功能连接图谱的特性对比,到DPABI实操中的多图谱分析工作流,提供了全面的方法论指导,助力提升静息态功能磁共振成像(rs-fMRI)研究的精准度和可重复性。

weixin_30654583的博客 403

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

FPGA编译加速实战:6大可落地的Vivado优化策略

FPGA编译本质上是NP-hard约束满足问题求解,而非传统软件编译;Vivado作为时序驱动的硬件实现工具链,其耗时瓶颈集中在Implementation阶段的布局布线(PnR)与逻辑优化。理解这一原理,才能跳出‘加线程’‘升版本’等表面优化,转向精准时序约束、增量编译、物理锚点控制、IP配置精简等工程级干预。这些技术手段直接作用于Vivado的Tcl执行流与底层求解空间,显著压缩搜索范围、减少无效迭代——尤其适用于Zynq/UltraScale等中大型项目(LUT > 80K、多时钟域、DDR/PCIe

weixin_34226182的博客 413

基于Python实现身份证信息识别

身份证是一种重要的证件,包含了个人的基本信息,如姓名、性别、出生日期、住址等。在实际应用中,有时需要对身份证进行自动化的识别,以提高工作效率和准确性。本文将介绍如何使用Python实现身份证信息的识别,通过图像预处理、OCR技术和解析算法,实现对身份证号码和其他信息的提取和解析。

商务合作 / 项目定制 / 学习交流。个人vx:lovely_wml 1万+

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

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

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

华为OD面试手撕真题 【合并相邻且相等的元素】多语言题解

华为OD面试高频手撕真题【合并相邻且相等的元素】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解。

qq_45776114的博客 546

poj union_find相关之1611 The Suspects

poj union-find 1611 The Suspects

ziqi9216的博客 295

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

SIMATIC S7-1200, S7-1500 PID 控制[手册]

SIMATIC S7-1200, S7-1500 PID 控制[手册]

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

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

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、付费专栏及课程。

余额充值