博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
poj 2236 Wireless Network
阅读量:4587 次
发布时间:2019-06-09

本文共 1996 字,大约阅读时间需要 6 分钟。

Wireless Network
Time Limit: 10000MS   Memory Limit: 65536K
Total Submissions: 21937   Accepted: 9222

Description

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 one by one, and the network gradually began to work again. Because of the hardware restricts, each computer can only directly communicate with the computers that are not farther than d meters from it. But every computer can be regarded as the intermediary of the communication between two other computers, that is to say computer A and computer B can communicate if computer A and computer B can communicate directly or there is a computer C that can communicate with both A and B. 
In the process of repairing the network, workers can take two kinds of operations at every moment, repairing a computer, or testing if two computers can communicate. Your job is to answer all the testing operations.

Input

The first line contains two integers N and d (1 <= N <= 1001, 0 <= d <= 20000). Here N is the number of computers, which are numbered from 1 to N, and D is the maximum distance two computers can communicate directly. In the next N lines, each contains two integers xi, yi (0 <= xi, yi <= 10000), which is the coordinate of N computers. From the (N+1)-th line to the end of input, there are operations, which are carried out one by one. Each line contains an operation in one of following two formats: 1. "O p" (1 <= p <= N), which means repairing computer p. 2. "S p q" (1 <= p, q <= N), which means testing whether computer p and q can communicate.
The input will not exceed 300000 lines.

Output

For each Testing operation, print "SUCCESS" if the two computers can communicate, or "FAIL" if not.

Sample Input

4 10 10 20 30 4O 1O 2O 4S 1 4O 3S 1 4

Sample Output

FAILSUCCESS

转载于:https://www.cnblogs.com/qinduanyinghua/p/5492254.html

你可能感兴趣的文章
RT600之OTFAD
查看>>
Unity3D研究院之使用Animation编辑器编辑动画(五十四)
查看>>
负载均衡
查看>>
剑指Offer-编程详解-二维数组中的查找
查看>>
ExtJs异步无法向外传值和赋值的解决办法,亲测有效
查看>>
窗口、视图、视图控制器
查看>>
[Codeforces 946G]Almost Increasing Array
查看>>
大型应用的javascript架构
查看>>
jQuery的Select操作集合
查看>>
HDU 2136 Largest prime factor
查看>>
HTTP状态码介绍
查看>>
HDR(High Dynamic Range) - 高动态范围
查看>>
Jquery学习开篇
查看>>
ADO.Net读取器获取数据库数据
查看>>
android调用系统录制视频
查看>>
python之路
查看>>
【leetcode❤python】 219. Contains Duplicate II
查看>>
Moss/sharepoint 匿名访问之看例做题
查看>>
[C# 基础知识系列]专题十六:Linq介绍
查看>>
Ubuntu10下MySQL搭建Amoeba_基础
查看>>