【CCF】无线网络 搜索+思维
#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】无线网络 搜索+思维的更多相关文章
- 【CCF】无线网络 搜索
[思路] 多个起点同时四周扩展广搜,注意会爆int [AC] #include<iostream> #include<cstdio> #include<cstring&g ...
- 破解无线网络密码-BT3如何使用2
本教程只作学习和交流使用,任何其它商用与本人无关, 在开始教程之前, 首先需要用到几个软件,感兴趣的朋友看完贴子后可以去百度搜一下下载地址, 虚拟机: VMware Workstation 6.5 正 ...
- 关于NOIP2014“无线网络发射器选址”一题的衍生题目的思考及思维方向
无线网络发射器选址 题目描述 随着智能手机的日益普及,人们对无线网的需求日益增大.某城市决定对城市内的公共场所覆盖无线网. 假设该城市的布局为由严格平行的129 条东西向街道和129 条南北向街道所形 ...
- CCF CSP 201403-4 无线网络
CCF计算机职业资格认证考试题解系列文章为meelo原创,请务必以链接形式注明本文地址 CCF CSP 201403-4 无线网络 问题描述 目前在一个很大的平面房间里有 n 个无线路由器,每个无线路 ...
- windows XP系统搜索无线网络时提示“windows无法配置此无线连接”,如何处理?
转自:http://support1.lenovo.com.cn/lenovo/wsi/htmls/detail_12839009034375918.html 文章编号:C191612 201 ...
- CCF模拟 无线网络
无线网络 时间限制: 1.0s 内存限制: 256.0MB 问题描述 目前在一个很大的平面房间里有 n 个无线路由器,每个无线路由器都固定在某个点上.任何两个无线路由器只要距离不超过 r 就能互相 ...
- 双系统下(Ubuntu + win7)windows 无法连接无线网络
双系统下(Ubuntu + win7)windows 无法连接无线网络 今天开机登录win7,突然发现无法使用无线网络(WiFi信号标志有个大红叉),于是查看设备驱动,一切正常,这就奇怪了:用Wind ...
- 跑PIN码破解无线网络WIFI密码的原理分析(转)
你们家用的无线路由器安全吗?有人蹭网吗?无线路由器的漏洞在哪里?这么避免蹭网? 想要了解这些,必须要了解加密以及破解原理. 工具/原料 电脑 足够多足够好的wifi信号源 usb无线网卡(非必需) 一 ...
- windows xp 无法连接wpa无线网络
其实以前一直是可以的,不知为什么前几天忽然就不能加入原有的无线网了.我的无线网是WPA加密的,采用DHCP分配IP(但针对特定MAC地址分配静态IP). 在网上找了许久,有的网友认为应该把无线网卡(那 ...
随机推荐
- Django 的母板及布局(Bootstrap)
title: Django 的母板及布局(Bootstrap) tags: Django --- Django 的母板及布局(Bootstrap) Django 的母板是作为公共的部分,其他的页面都能 ...
- 简易数据分析 02 | Web Scraper 的下载与安装
这是简易数据分析系列的第 2 篇文章. 上篇说了数据分析在生活中的重要性,从这篇开始,我们就要进入分析的实战内容了.数据分析数据分析,没有数据怎么分析?所以我们首先要学会采集数据. 我调研了很多采集数 ...
- Silverlight日记:动态生成DataGrid、行列装换、动态加载控件
本文主要针对使用DataGrid动态绑定数据对象,并实现行列转换效果. 一,前台绑定 <sdk:DataGrid x:Name="dataGrid2" Style=" ...
- oracle系統表、數據字典介紹與日常問題診斷
oracle系統表.數據字典介紹與日常問題診斷 數據字典是由唯讀的table和view組成的,產生於$oracle_home\rdbms\admin\catalog.sql.裡面儲存Oracle資料庫 ...
- 01_8_session
01_8_session 1. session总结 1.1服务器的一块内存(存key-value) 1.2和客户端窗口对应(子窗口)(独一无二) 1.3客户端和服务器有对应的SessionID 1.4 ...
- LEETCODE60——第K个排列
class Solution { public: string getPermutation(int n, int k) { '); vector<bool> flag(n, false) ...
- Linux:FTP服务匿名用户,本地用户,虚拟用户配置
匿名用户 FTP协议占用两个端口号: 21端口:命令控制,用于接收客户端执行的FTP命令. 20端口:数据传输,用于上传.下载文件数据. 实验:匿名访问,服务器192.168.10.10 客户 ...
- Jenkins忘记管理员密码处理
1.先找到jenkins安装目录打开config.xml文件. 2.然后编辑,删除以下部分: <useSecurity>true</useSecurity> <autho ...
- ProC第二弹
一.提要 上文简单介绍了Windows下ProC配置开发,这次我们使用Linux平台再次配置Oracle ProC开发环境(RedHat Linux 9 + Oracle 92). <OR ...
- LeetCode(279)Perfect Squares
题目 Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9 ...