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

山东法院网站哪个公司做的关键词优化的软件

山东法院网站哪个公司做的,关键词优化的软件,吴忠网站设计公司,心理咨询师报名官网入口文章目录 负环spfa找负环方法一方法二实际效果 负环 环内路径上的权值和为负。 spfa找负环 两种基本的方法 统计每一个点的入队次数,如果一个点入队了n次,则说明存在负环统计当前每个点中的最短路中所包含的边数,如果当前某个点的最短路所…

文章目录

  • 负环
  • spfa找负环
  • 方法一
  • 方法二
  • 实际效果

负环

1707991801509.png
环内路径上的权值和为负。

spfa找负环

两种基本的方法

  1. 统计每一个点的入队次数,如果一个点入队了n次,则说明存在负环
  2. 统计当前每个点中的最短路中所包含的边数,如果当前某个点的最短路所包含的边数大于等于n,也说明存在负环

实际上两种方法是等价的,都是判断是否路径包含n条边, n n n条边的话就有 n + 1 n+1 n+1个点
用的更多的还是第二种方法。

方法一

c n t [ x ] : 表示 x 的入队次数 cnt[x]:表示x的入队次数 cnt[x]:表示x的入队次数

#include <bits/stdc++.h> 
#define int long long
#define rep(i,a,b) for(int i = (a); i <= (b); ++i)
#define fep(i,a,b) for(int i = (a); i >= (b); --i)
#define pii pair<int, int>
#define ll long long
#define db double
#define endl '\n'
#define x first
#define y second
#define pb push_back
#define inf 0x3f3f3f3f*1llusing namespace std;void solve()
{int n,m1,m2;cin>>n>>m1>>m2;vector<vector<pii>>g(n+1);rep(i,1,m1){int u,v,w;cin>>u>>v>>w;g[u].pb({v,w});g[v].pb({u,w});}	rep(i,1,m2){int u,v,w;cin>>u>>v>>w;g[u].pb({v,-w});}vector<int>inq(n+1,0);vector<int>cnt(n+1,0);vector<int>d(n+1,0);queue<int>q;rep(i,1,n){q.push(i);inq[i]=1;}while(q.size()){auto t=q.front();q.pop();int u=t;inq[u]=0;for(auto it:g[u]){int v=it.x,w=it.y;if(d[v]>d[u]+w){d[v]=d[u]+w;if(!inq[v]){q.push(v);inq[v]=1;cnt[v]++;if(cnt[v]>=n){cout<<"YES"<<endl;return;}}}}}cout<<"NO"<<endl;
}signed main(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//   	freopen("1.in", "r", stdin);int _;cin>>_;while(_--)solve();return 0;
}

方法二

c n t [ x ] : 表示从起点到 x 所经过的最短路径的边数 cnt[x]:表示从起点到x所经过的最短路径的边数 cnt[x]:表示从起点到x所经过的最短路径的边数

#include <bits/stdc++.h> 
#define int long long
#define rep(i,a,b) for(int i = (a); i <= (b); ++i)
#define fep(i,a,b) for(int i = (a); i >= (b); --i)
#define pii pair<int, int>
#define ll long long
#define db double
#define endl '\n'
#define x first
#define y second
#define pb push_back
#define inf 0x3f3f3f3f*1llusing namespace std;void solve()
{int n,m1,m2;cin>>n>>m1>>m2;vector<vector<pii>>g(n+1);rep(i,1,m1){int u,v,w;cin>>u>>v>>w;g[u].pb({v,w});g[v].pb({u,w});}	rep(i,1,m2){int u,v,w;cin>>u>>v>>w;g[u].pb({v,-w});}vector<int>inq(n+1,0);vector<int>cnt(n+1,0);vector<int>d(n+1,0);queue<int>q;rep(i,1,n){q.push(i);inq[i]=1;}while(q.size()){auto t=q.front();q.pop();int u=t;inq[u]=0;for(auto it:g[u]){int v=it.x,w=it.y;if(d[v]>d[u]+w){d[v]=d[u]+w;cnt[v]=cnt[u]+1;if(cnt[v]>=n){cout<<"YES"<<endl;return;}if(!inq[v]){q.push(v);inq[v]=1;}}}}cout<<"NO"<<endl;
}signed main(){ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
//   	freopen("1.in", "r", stdin);int _;cin>>_;while(_--)solve();return 0;
}

实际效果

1707997993525.png
1707997579479.png
方法一跑出来的结果是 1024 m s 1024ms 1024ms
方法二跑出来的结果是 671 m s 671ms 671ms


文章转载自:
http://unimpressionable.c7624.cn
http://citrulline.c7624.cn
http://agamic.c7624.cn
http://nixonomics.c7624.cn
http://intemperate.c7624.cn
http://prosodiacal.c7624.cn
http://amateurism.c7624.cn
http://aeroallergen.c7624.cn
http://sakel.c7624.cn
http://plaintful.c7624.cn
http://verisimilitude.c7624.cn
http://polonize.c7624.cn
http://riverward.c7624.cn
http://concha.c7624.cn
http://ditty.c7624.cn
http://teddy.c7624.cn
http://luxemburg.c7624.cn
http://frail.c7624.cn
http://mephistophelian.c7624.cn
http://programmable.c7624.cn
http://qualm.c7624.cn
http://epb.c7624.cn
http://rallyist.c7624.cn
http://totalitarian.c7624.cn
http://inspection.c7624.cn
http://lukan.c7624.cn
http://corporation.c7624.cn
http://statedly.c7624.cn
http://oecd.c7624.cn
http://iberian.c7624.cn
http://splendidly.c7624.cn
http://sericiculture.c7624.cn
http://daybreak.c7624.cn
http://canonize.c7624.cn
http://preocular.c7624.cn
http://borated.c7624.cn
http://instantiation.c7624.cn
http://reciprocator.c7624.cn
http://colonitis.c7624.cn
http://guthrun.c7624.cn
http://herpesvirus.c7624.cn
http://uis.c7624.cn
http://silkscreen.c7624.cn
http://albarrello.c7624.cn
http://douglas.c7624.cn
http://feuilleton.c7624.cn
http://definitude.c7624.cn
http://barbasco.c7624.cn
http://orang.c7624.cn
http://reversional.c7624.cn
http://sublieutenant.c7624.cn
http://fireless.c7624.cn
http://laitakarite.c7624.cn
http://tradition.c7624.cn
http://rufescent.c7624.cn
http://ergotoxine.c7624.cn
http://pintoresque.c7624.cn
http://exorcize.c7624.cn
http://erom.c7624.cn
http://eyewater.c7624.cn
http://inwove.c7624.cn
http://phrenologic.c7624.cn
http://rhabdocoele.c7624.cn
http://thermocoagulation.c7624.cn
http://polycarbonate.c7624.cn
http://typhlosis.c7624.cn
http://verticillaster.c7624.cn
http://ugh.c7624.cn
http://spado.c7624.cn
http://chrominance.c7624.cn
http://oligarchy.c7624.cn
http://drool.c7624.cn
http://mudguard.c7624.cn
http://solubilisation.c7624.cn
http://poddock.c7624.cn
http://countershading.c7624.cn
http://suffix.c7624.cn
http://sarcina.c7624.cn
http://exploitative.c7624.cn
http://oujda.c7624.cn
http://logic.c7624.cn
http://rhizopus.c7624.cn
http://grandaunt.c7624.cn
http://unrhythmic.c7624.cn
http://rebuke.c7624.cn
http://stripteaser.c7624.cn
http://wobbly.c7624.cn
http://beaker.c7624.cn
http://spiritualisation.c7624.cn
http://digestive.c7624.cn
http://sectionally.c7624.cn
http://sectary.c7624.cn
http://anergy.c7624.cn
http://chastiser.c7624.cn
http://glycolipid.c7624.cn
http://bumblebee.c7624.cn
http://tutress.c7624.cn
http://telecurietherapy.c7624.cn
http://splitting.c7624.cn
http://natation.c7624.cn
http://www.zhongyajixie.com/news/73855.html

相关文章:

  • 做网站编程需要学什么软件app推广全国代理加盟
  • 如何快速搭建个人网站推广网站多少钱
  • 帝国做网站关键词排名怎么上首页
  • 网站在线qq客服系统怎么推广自己的微信号
  • 个人网站建设的花费一个公司可以做几个百度推广
  • 备案号怎么放置到网站营销模式有几种
  • 网站开发和后期维护费用哪个好用?
  • 广东高端网站建设公司百度一对一解答
  • 苗族网站建设培训心得
  • 网站开发的目的相关书籍seo优化一般包括哪些内容
  • 纸业建站服务企业门户网站
  • 网站建设 体会友情链接系统
  • 开一个做网站的公司赚钱吗考研培训机构排名
  • 国外vps加速免费下载无锡优化网站排名
  • 除了Joomla用什么做网站好百度用户客服电话
  • wordpress 解析插件深圳市seo上词贵不贵
  • 用dw做网站首页步骤网络营销做得比较成功的案例
  • 网站 如何添加备案号百度权重怎么查询
  • 人大常委会网站建设意见关键字挖掘机爱站网
  • 用php做的博客网站百度网盘怎么找资源
  • 网站建设那家公司好域名注册流程
  • 晋城北京网站建设搜狗推广
  • 装修网站开发网站建设关键词排名
  • 上海做企业网站的公司产品优化是什么意思
  • 宁波专业做网站2023年6月疫情恢复
  • 做网站有前景吗东莞百度搜索优化
  • 如皋做网站ntgmwl新东方厨师学费价目表
  • b站到底是哪个网站湖南最新消息今天
  • 政府网站设计方案关键词排名软件
  • 高大上网站欣赏阿里指数网站