PTA File Transfer

博客探讨了一种网络中电脑间文件传输的问题,通过建立并查集数据结构解决。内容涉及输入输出规格,解题思路包括集合合并与搜索,使用数组存储节点联系,通过按秩归并压缩树的深度,确保网络中任意两台电脑间存在路径。作者指出了按秩归并相对于路径压缩的优势,并提供了测试数据链接。
摘要由CSDN通过智能技术生成

We have a network of computers and a list of bi-directional connections. Each of these connections allows a file transfer from one computer to another. Is it possible to send a file from any computer on the network to any other?

Input Specification:

Each input file contains one test case. For each test case, the first line contains N (2≤N≤10​4​​), the total number of computers in a network. Each computer in the network is then represented by a positive integer between 1 and N. Then in the following lines, the input is given in the format:

 

where I stands for inputting a connection between c1 and c2; or

 

where C stands for checking if it is possible to transfer files between c1 and c2; or

 

where S stands for stopping this case. 

Output Specification:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值