DisJSet:Wireless Network(POJ 2236)】的更多相关文章

  无线电网络 题目大意:就是地震后,所有的电脑都坏了,现在可以修复,而且要重新连成一个网络,两台电脑之间最大连接距离为D,两台电脑可以有中继电脑,按O修复电脑,按S测试两台电脑是否有链接,如果有就输出SUCCESS,不行就FAIL 一看到电脑,我就联想到了查并集,这一题也不例外,我们维护在距离内的查并集就可以了,具体思路不难,每一次修复都扫描所有的节点看能否连接即可 #include <iostream> #include <functional> #include <al…
Wireless Network Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 20724   Accepted: 8711 Description An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computer…
An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computers, but an unexpected aftershock attacked, all computers in the network were all broken. The computers are repaired…
链接: http://poj.org/problem?id=2236 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82830#problem/A 代码: #include<stdio.h> #include<string.h> #include<stdlib.h> #include<math.h> #include<algorithm> #include<iostream>…
#include<iostream> #include<vector> #include<string> #include<cmath> #include<algorithm> #include<cstdio> #include<cstring> using namespace std; int n, d; ][]; struct Point { double x, y; }cur[]; ]; int findRoot(i…
题目大意:有n台坏掉的电脑,给出每台电脑的坐标,然后每次询问输入0(字符) x,表示电脑x恢复正常,输入S x y 询问x和y是否可以联网.只要是x和y的距离小于距离d,那么就可以联网,如果有个中介c使得x到c的距离小于d,y到c的距离小于d,那么x和y也可以联网. 题解:当修复好一台电脑后,然后判断与之前修好的电脑的距离,小于d的话,用并查集连在一起.(没敢这样想,感觉这样会T....) #include<cstdio> #include<iostream> #include&l…
A - Wireless Network POJ - 2236 Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 50348   Accepted: 20619 Description An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with…
POJ 2236 Wireless Network http://poj.org/problem?id=2236 题目大意: 给你N台损坏的电脑坐标,这些电脑只能与不超过距离d的电脑通信,但如果x和y均能C通信,则x和y可以通信.现在给出若干个操作, O p 代表修复编号为p的电脑 S p q代表询问p和q是不是能通信. 思路: 并查集即可.. 如果修复了一台电脑,则把与它相连距离不超过d的且修复了的放在一个集合里面. #include<cstdio> #include<cstring&…
Wireless Network Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 25022   Accepted: 10399 Description An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap compute…
Wireless Network Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 16065   Accepted: 6778 Description An earthquake takes place in Southeast Asia. The ACM (Asia Cooperated Medical team) have set up a wireless network with the lap computer…