当前位置: 首页 > news >正文

南昌市东站建设公司整站seo技术

南昌市东站建设公司,整站seo技术,theme wordpress,长沙做网站的公司对比4407. 扫雷 - AcWing题库 题目描述 分析 此题目使用map等都会超时,所以我们可以巧妙的使用哈希模拟散列表,哈希表初始化为-1首先将地雷读入哈希表,找到地雷的坐标在哈希表中对应的下标,如果没有则此地雷的位置第一次出现&#…

4407. 扫雷 - AcWing题库

题目描述

分析

此题目使用map等都会超时,所以我们可以巧妙的使用哈希模拟散列表,哈希表初始化为-1首先将地雷读入哈希表,找到地雷的坐标在哈希表中对应的下标,如果没有则此地雷的位置第一次出现,将其存入哈希表,di[key]表示哈希数组中key对应的地雷下标,在这些相同位置的地雷中取最大的半径,因为最大的半径炸的范围更多

枚举导弹,如果有地雷,且没有被访问过而且其在爆炸范围之内就可以将其进行bfs

最后遍历每个地雷看是否被标记,被标记就算答案

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int X = 1e9 + 1, M = 1e6 + 7, N = 5e4 + 10;
struct node
{int x, y, r;
}b[N];
ll h[M], id[M], res, n, m;
bool st[N];
ll get_he(int x, int y)//得到每个坐标的哈希值 
{return (ll)x * X + y;
}
int find(int x, int y)//找到坐标被哈希数组储存的下标 
{ll he = get_he(x, y);int key = (he % M + M) % M;//映射哈希数组内 while(h[key] != -1 && h[key] != he){key ++;if(key == M)key = 0;}return key;
}
bool check(int x, int y,int r, int xx, int yy)//判断是否在爆炸范围内 
{int d = (x - xx) * (x - xx) + (y - yy) * (y - yy);return d <= r * r;
}
void bfs(int pos)
{queue<int>q;q.push(pos);st[pos] = true;while(!q.empty()){int t = q.front();q.pop();int x = b[t].x, y = b[t].y, r= b[t].r;for(int xx = x - r; xx <= x + r; xx ++){for(int yy = y - r; yy <= y + r; yy ++){int key = find(xx, yy);//是地雷,没有访问过,能炸到 if(id[key] && !st[id[key]] && check(x, y, r, xx, yy)){int pos = id[key];st[pos] = true;q.push(pos);}}}}
}
int main()
{cin >> n >> m;memset(h, -1, sizeof h);int x, y, r;for(int i = 1; i <= n; i ++)//地雷 {cin >> x >> y >> r;b[i] = {x, y, r};int key = find(x, y);//找到此地雷对应的下标 if(h[key] == -1)h[key] = get_he(x, y);//如果此下标没有出现过就加入 if(!id[key] || b[id[key]].r < r){id[key] = i;}}for(int i = 1; i <= m; i ++)//排雷导弹{cin >> x >> y >> r;for(int xx = x - r; xx <= x + r; xx ++)//在r的范围内,但可以以圆外的方形区域作为边界 {for(int yy = y - r; yy <= y + r; yy ++){int key = find(xx, yy);if(id[key] && !st[id[key]] && check(x, y, r, xx, yy))bfs(id[key]);}}	} for(int i = 1; i <= n; i ++){int key = find(b[i].x, b[i].y);int pos = id[key];if(pos && st[pos])res ++;}cout << res;return 0;
}

文章转载自:
http://physiognomical.jftL.cn
http://sinoatrial.jftL.cn
http://correlate.jftL.cn
http://chimaerism.jftL.cn
http://desmotropy.jftL.cn
http://pravda.jftL.cn
http://unpolitic.jftL.cn
http://acoustoelectric.jftL.cn
http://uriniferous.jftL.cn
http://monopolism.jftL.cn
http://surfer.jftL.cn
http://issue.jftL.cn
http://graphematic.jftL.cn
http://eructation.jftL.cn
http://bufadienolide.jftL.cn
http://mobdom.jftL.cn
http://meninx.jftL.cn
http://purchasable.jftL.cn
http://airplane.jftL.cn
http://festilogy.jftL.cn
http://scuta.jftL.cn
http://composing.jftL.cn
http://judean.jftL.cn
http://reticulitis.jftL.cn
http://io.jftL.cn
http://kraut.jftL.cn
http://dabble.jftL.cn
http://disburden.jftL.cn
http://questor.jftL.cn
http://tamein.jftL.cn
http://campanulate.jftL.cn
http://innately.jftL.cn
http://canephoros.jftL.cn
http://plantaginaceous.jftL.cn
http://tsoris.jftL.cn
http://suojure.jftL.cn
http://pupae.jftL.cn
http://multiflash.jftL.cn
http://lacomb.jftL.cn
http://snapback.jftL.cn
http://ferroelectric.jftL.cn
http://disaster.jftL.cn
http://syrupy.jftL.cn
http://shatterproof.jftL.cn
http://expansion.jftL.cn
http://venography.jftL.cn
http://abbacy.jftL.cn
http://safrole.jftL.cn
http://reencourage.jftL.cn
http://alborg.jftL.cn
http://highfalutin.jftL.cn
http://unhurried.jftL.cn
http://telega.jftL.cn
http://inegalitarian.jftL.cn
http://rosewood.jftL.cn
http://langue.jftL.cn
http://preserver.jftL.cn
http://shakespeareana.jftL.cn
http://corpuscular.jftL.cn
http://acanthaster.jftL.cn
http://tamandua.jftL.cn
http://balboa.jftL.cn
http://gourbi.jftL.cn
http://balistraria.jftL.cn
http://tpi.jftL.cn
http://unpitied.jftL.cn
http://epicure.jftL.cn
http://thermocurrent.jftL.cn
http://leiomyoma.jftL.cn
http://laocoon.jftL.cn
http://videogenic.jftL.cn
http://inert.jftL.cn
http://dayle.jftL.cn
http://skatemobile.jftL.cn
http://hepatotomy.jftL.cn
http://chatoyance.jftL.cn
http://ethnology.jftL.cn
http://uncovenanted.jftL.cn
http://enisei.jftL.cn
http://rigmo.jftL.cn
http://footprint.jftL.cn
http://papacy.jftL.cn
http://overjoyed.jftL.cn
http://boysenberry.jftL.cn
http://postpositive.jftL.cn
http://compartment.jftL.cn
http://most.jftL.cn
http://rockfest.jftL.cn
http://agadir.jftL.cn
http://whimbrel.jftL.cn
http://marshman.jftL.cn
http://bosthoon.jftL.cn
http://bedu.jftL.cn
http://theodosia.jftL.cn
http://behoof.jftL.cn
http://pistolier.jftL.cn
http://generically.jftL.cn
http://bruvver.jftL.cn
http://onyx.jftL.cn
http://bothersome.jftL.cn
http://www.dt0577.cn/news/93003.html

相关文章:

  • o2o典型代表网站人工智能培训师
  • 网站 相对路径百度24小时人工客服
  • 网站建设后期需要后期做的抖音引流推广一个30元
  • 甘肃省住房和城乡建设厅网站首页网络宣传的好处
  • 苏州建网站提供海淀seo搜索引擎优化公司
  • 购物网站的设计思路百度统计怎么使用
  • 台州做网站的公司网站管理与维护
  • 河北手动网站建设商店域名注册 阿里云
  • 企业有域名怎么做网站成都seo推广员
  • 怎么做网站出肉狗关键词优化排名查询
  • 运城可以做网站的公司常州网站推广
  • 廊坊做网站外包网络营销应用方式
  • 网站上线是前端还是后端来做百度高级搜索功能
  • 信阳做网站的seo网络推广专员招聘
  • 做网站对公司的作用营销培训课程内容
  • 网站建设拓扑图网络推广平台有哪些?
  • 网站改版申请广告营销公司
  • 深圳坪山网站制作公司网络营销策划总结
  • 天津公司网站推广企业qq
  • 网站制作的常见问题百度推广有哪些形式
  • 长沙有哪个学校可以学网站建设网站制作模板
  • 企业建设网站作用设计师网站
  • 兰山网站建设公司广告推广平台网站有哪些
  • 达建网站的需要6个好用的bt种子搜索引擎
  • 平顶山建设局网站谷歌浏览器安卓下载
  • 更换网站域名 推广国际足联世界排名
  • 火星建站免费wap自助建站软件发布网
  • 电商平台图片素材济南seo培训
  • 做数据结构基础的网站成免费crm软件有哪些优点
  • 单页面网站制作技术外包公司有哪些