#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<vector> using namespace std;
typedef long long ll;
const double eps=1e-;
const int maxn=2e2+;
const int maxm=maxn*maxn;
int n,m,k;
ll r;
struct node{
ll x;
ll y;
node(ll _x,ll _y):x(_x),y(_y){}
};
vector<node> g;
bool vis[maxn];
struct Node{
int id;
int step;
int k;
Node(int _id,int _step,int _k):id(_id),step(_step),k(_k){}
};
bool judge(int u,int v){
ll tmp=(g[u].x-g[v].x)*(g[u].x-g[v].x)+(g[u].y-g[v].y)*(g[u].y-g[v].y);
if(tmp<=r*r) return true;
return false;
}
struct edge{
int to;
int nxt;
}e[*maxm];
int tot;
int head[maxn];
void init(){
g.clear();
memset(head,-,sizeof(head));
tot=;
memset(vis,false,sizeof(vis));
}
void add(int u,int v){
e[tot].to=v;
e[tot].nxt=head[u];
head[u]=tot++;
}
int bfs(){
int s=,t=;
queue<Node> Q;
Q.push(Node(s,,));
while(!Q.empty()){
Node q=Q.front();
Q.pop();
if(q.id==t){
return q.step;
}
if(vis[q.id]) continue;
vis[q.id]=true;
int u=q.id;
for(int i=head[u];i!=-;i=e[i].nxt){
int v=e[i].to;
if(v<=n){
Q.push(Node(v,q.step+,q.k));
}else{
if(q.k+<=k){
Q.push(Node(v,q.step+,q.k+));
}
}
} }
return -;
}
int work(){
return bfs()-;
}
int main(){
while(~scanf("%d%d%d%lld",&n,&m,&k,&r)){
init();
ll x,y;
g.push_back(node(,));
for(int i=;i<=n;i++){
scanf("%lld%lld",&x,&y);
g.push_back(node(x,y));
}
for(int i=;i<=m;i++){
scanf("%lld%lld",&x,&y);
g.push_back(node(x,y));
}
for(int i=;i<=n+m;i++){
for(int j=i+;j<=n+m;j++){
if(judge(i,j)){
add(i,j);
add(j,i);
}
}
}
int ans=work();
printf("%d\n",ans);
}
return ;
}

【CCF】无线网络 搜索+思维的更多相关文章

  1. 【CCF】无线网络 搜索

    [思路] 多个起点同时四周扩展广搜,注意会爆int [AC] #include<iostream> #include<cstdio> #include<cstring&g ...

  2. 破解无线网络密码-BT3如何使用2

    本教程只作学习和交流使用,任何其它商用与本人无关, 在开始教程之前, 首先需要用到几个软件,感兴趣的朋友看完贴子后可以去百度搜一下下载地址, 虚拟机: VMware Workstation 6.5 正 ...

  3. 关于NOIP2014“无线网络发射器选址”一题的衍生题目的思考及思维方向

    无线网络发射器选址 题目描述 随着智能手机的日益普及,人们对无线网的需求日益增大.某城市决定对城市内的公共场所覆盖无线网. 假设该城市的布局为由严格平行的129 条东西向街道和129 条南北向街道所形 ...

  4. CCF CSP 201403-4 无线网络

    CCF计算机职业资格认证考试题解系列文章为meelo原创,请务必以链接形式注明本文地址 CCF CSP 201403-4 无线网络 问题描述 目前在一个很大的平面房间里有 n 个无线路由器,每个无线路 ...

  5. windows XP系统搜索无线网络时提示“windows无法配置此无线连接”,如何处理?

    转自:http://support1.lenovo.com.cn/lenovo/wsi/htmls/detail_12839009034375918.html 文章编号:C191612     201 ...

  6. CCF模拟 无线网络

    无线网络 时间限制: 1.0s 内存限制: 256.0MB   问题描述 目前在一个很大的平面房间里有 n 个无线路由器,每个无线路由器都固定在某个点上.任何两个无线路由器只要距离不超过 r 就能互相 ...

  7. 双系统下(Ubuntu + win7)windows 无法连接无线网络

    双系统下(Ubuntu + win7)windows 无法连接无线网络 今天开机登录win7,突然发现无法使用无线网络(WiFi信号标志有个大红叉),于是查看设备驱动,一切正常,这就奇怪了:用Wind ...

  8. 跑PIN码破解无线网络WIFI密码的原理分析(转)

    你们家用的无线路由器安全吗?有人蹭网吗?无线路由器的漏洞在哪里?这么避免蹭网? 想要了解这些,必须要了解加密以及破解原理. 工具/原料 电脑 足够多足够好的wifi信号源 usb无线网卡(非必需) 一 ...

  9. windows xp 无法连接wpa无线网络

    其实以前一直是可以的,不知为什么前几天忽然就不能加入原有的无线网了.我的无线网是WPA加密的,采用DHCP分配IP(但针对特定MAC地址分配静态IP). 在网上找了许久,有的网友认为应该把无线网卡(那 ...

随机推荐

  1. python 基础之for循环有限循环

    #  range(3) 表示 >>> range(3) [0, 1, 2] for循环 for i in range(3): print(i) 测试 0 1 2 打印1~100的奇数 ...

  2. key directories in the linux file system

    Key directories in the file system: */: Root directory (base of file system) /bin: Executable progra ...

  3. Diff Two Arrays-freecodecamp算法题目

    Diff Two Arrays(比较两个数组) 1.要求 比较两个数组,然后返回一个新数组 该数组的元素为两个给定数组中所有独有的数组元素.换言之,返回两个数组的差异. 2.思路 定义一个新数组变量, ...

  4. Vue表单输入绑定

    <h3>基础用法</h3> <p>你可以用<strong>v-model</strong>指令在表单input,textarea以及sele ...

  5. 嵌入式入门学习笔记3:[转]编译linux

    摘自:https://blog.csdn.net/baidu_24256693/article/details/80115354 编译Linux是什么意思? Linux内核是Linux操作系统的核心, ...

  6. ARM CORTEX-M3的时钟

    转载自:http://www.cnblogs.com/javado/p/7704579.html 这几天写了一段测试代码,跑在LPC812上面. 很吃惊的发现CPU速度为1M 时钟 串口为12M时钟 ...

  7. Vmware安装与使用

    1)双击击VMware Workstation启动安装 2)接下来Ctrl+N快捷键(或者点选菜单Flie->New virtual machine)来创建一个新的虚拟机. 3)Custom(a ...

  8. LA 3667 Ruler 搜索

    题意: 给出\(n\)个长度,要设计一个有\(m\)个刻度的刻度尺,刻度尺的刻度从\(0\)开始. 使得任意一个长度都能被该刻度尺度量出来. 首先要使\(m\)最小,在\(m\)最小的前提下尺子的长度 ...

  9. Linux的档案权限与目录配置练习题

    1.请说明/bin与/usr/bin目录所防止的执行文件有何不同之处:/bin主要放置在开机时,以及进入单人维护模式后还能够被使用的指令,至于/usr/bin则是大部分软件提供的指令放置处 2.请说明 ...

  10. mysql 对时间的处理

    引自: @author:http://www.cnblogs.com/geaozhang/ 可能的需求: 当前时间是多少.下个月的今天是星期几.统计截止到当前日期前 3 天的收入总和…… 上述需求就需 ...