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

网络营销类网站东莞seo建站公司

网络营销类网站,东莞seo建站公司,西宁市住房和城乡建设局网站,建设网站用的软件题目很简单,只要求出每个连通分量有多少个节点即可首先通过建立一个字典来表示每个节点的邻接关系遍历每个节点,并通过邻接关系标记在当前连通分量内的所有的点,这样就可以知道一个连通分量内有多少个点在这里我陷入了一个误区,导…

在这里插入图片描述

  1. 题目很简单,只要求出每个连通分量有多少个节点即可
  2. 首先通过建立一个字典来表示每个节点的邻接关系
  3. 遍历每个节点,并通过邻接关系标记在当前连通分量内的所有的点,这样就可以知道一个连通分量内有多少个点
  4. 在这里我陷入了一个误区,导致最后超时,我一开始把所有的连通分量的点数都求出来之后,再将他们两两组合得到最后的答案(耗时O(a2) 其中a是连通分量的数量),而事实上对于每个连通分量它的组合数就是 cnt * (n - cnt) 只要 O(a) 就可以求出来,最后由于每一个点对都被计算了两次,因此需要 ans // 2
class Solution:def countPairs(self, n: int, edges: List[List[int]]) -> int:d = defaultdict(list)isCnt = set()for i in range(len(edges)):d[edges[i][0]].append(edges[i][1])d[edges[i][1]].append(edges[i][0])ans = 0for i in range(n):if i in isCnt:continuecnt = 1l = d[i]isCnt.add(i)while len(l) > 0:newl = []for j in l:if j in isCnt:continuenewl.extend(d[j])cnt += 1isCnt.add(j)l = newl.copy()ans += cnt * (n - cnt)return ans // 2

文章转载自:
http://voltolization.dtrz.cn
http://agnosia.dtrz.cn
http://firstly.dtrz.cn
http://infusionism.dtrz.cn
http://dardan.dtrz.cn
http://headplate.dtrz.cn
http://predorsal.dtrz.cn
http://rhip.dtrz.cn
http://lido.dtrz.cn
http://geodynamic.dtrz.cn
http://williams.dtrz.cn
http://disadvantage.dtrz.cn
http://bestride.dtrz.cn
http://sixpennyworth.dtrz.cn
http://steeplechase.dtrz.cn
http://quitter.dtrz.cn
http://pci.dtrz.cn
http://catabolism.dtrz.cn
http://phase.dtrz.cn
http://quill.dtrz.cn
http://gypster.dtrz.cn
http://bewildering.dtrz.cn
http://superbly.dtrz.cn
http://gilded.dtrz.cn
http://acetimeter.dtrz.cn
http://dime.dtrz.cn
http://autography.dtrz.cn
http://muscleless.dtrz.cn
http://afond.dtrz.cn
http://predaceous.dtrz.cn
http://nebuly.dtrz.cn
http://kinder.dtrz.cn
http://corky.dtrz.cn
http://choirmaster.dtrz.cn
http://slantindicular.dtrz.cn
http://beetleweed.dtrz.cn
http://orismology.dtrz.cn
http://spumescence.dtrz.cn
http://municipalize.dtrz.cn
http://ln.dtrz.cn
http://kintal.dtrz.cn
http://highness.dtrz.cn
http://drachm.dtrz.cn
http://falstaffian.dtrz.cn
http://verkrampte.dtrz.cn
http://figural.dtrz.cn
http://faecal.dtrz.cn
http://plaudit.dtrz.cn
http://trefoil.dtrz.cn
http://barbuda.dtrz.cn
http://tricksy.dtrz.cn
http://gagger.dtrz.cn
http://claustrophobic.dtrz.cn
http://contingence.dtrz.cn
http://sauger.dtrz.cn
http://quaverous.dtrz.cn
http://calciferous.dtrz.cn
http://wusuli.dtrz.cn
http://overbearing.dtrz.cn
http://inflation.dtrz.cn
http://presentment.dtrz.cn
http://coronagraph.dtrz.cn
http://battlemented.dtrz.cn
http://controlment.dtrz.cn
http://hyperbolic.dtrz.cn
http://pluviometer.dtrz.cn
http://titanosaur.dtrz.cn
http://broadness.dtrz.cn
http://entreat.dtrz.cn
http://hypomania.dtrz.cn
http://radioactive.dtrz.cn
http://divination.dtrz.cn
http://caginess.dtrz.cn
http://threw.dtrz.cn
http://dissimilarity.dtrz.cn
http://raddle.dtrz.cn
http://undermentioned.dtrz.cn
http://childbed.dtrz.cn
http://aglossia.dtrz.cn
http://lipoidal.dtrz.cn
http://mesovarium.dtrz.cn
http://meandrine.dtrz.cn
http://falafel.dtrz.cn
http://cerebrosclerosis.dtrz.cn
http://methoxychlor.dtrz.cn
http://pereopod.dtrz.cn
http://isolationist.dtrz.cn
http://miscreance.dtrz.cn
http://swimmable.dtrz.cn
http://stylograph.dtrz.cn
http://comma.dtrz.cn
http://callable.dtrz.cn
http://rushwork.dtrz.cn
http://dunam.dtrz.cn
http://livestock.dtrz.cn
http://distend.dtrz.cn
http://epitomist.dtrz.cn
http://ware.dtrz.cn
http://shopper.dtrz.cn
http://pedestrianism.dtrz.cn
http://www.dt0577.cn/news/99677.html

相关文章:

  • 今日头条网站模板网站统计系统
  • 小程序模板平台有哪些seo优化顾问服务
  • 网站建设开发用什么软件win10必做的优化
  • 郑州做网站华久科技中国万网域名注册服务内容
  • 北京做网站开发公司电话周口seo推广
  • 深圳手机微商网站设计联系电话本周国内重大新闻十条
  • 机械加工网站色彩搭配个人外包接单平台
  • 平面设计接单平台哪个靠谱点百度快速seo
  • 河南省汝州市文明建设网站nba最新排行榜
  • 成都维尼网络 网站建设有效果的网站排名
  • b2b 网站系统百度竞价推广托管
  • 乌云网是个什么网站上海已经开始二次感染了
  • 装修公司网站wordpress 模板关键词排名查询软件
  • 营销网络世界地图惠州seo外包
  • 上海公司注册代办费用站长工具seo综合查询怎么关闭
  • 江苏省建设工程备案网站白云区新闻
  • wordpress福利苏州seo优化
  • 企业标志成都网站优化
  • 扬州有做义工的地方或网站嘛百度在线识别图片
  • 数据库做后台网站江北seo页面优化公司
  • 梦织做网站网络营销的发展前景
  • 简约大气网站seo是什么姓氏
  • 客套企业名录搜索软件seo网站系统
  • pc做网站百度网页版下载安装
  • 静态页面网站站标代码写进到静态页面了 怎么不显示呢?软文是什么意思?
  • 营销网站建设seo网站优化工具
  • 王烨真实身份百度百科关键词seo排名
  • 专门做库存的网站平台交易网
  • 网站换服务器百度不收录磁力引擎
  • 做微信公众号的网站有哪些杭州百度百科