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

做网站设计和推广解析域名网站

做网站设计和推广,解析域名网站,各网站的网络联盟,专业集团门户网站建设企业题目描述 松鼠宝宝由于贪玩去了一个具有n个点和m条边的无向图中,现在松鼠宝宝仅有h点体力,所有的边经过一次后会消耗部分体力,同时松鼠爸爸为了惩罚贪玩的松鼠宝宝,每到一个点会扣除部分松果(起点的松果也会扣除&#…

题目描述

松鼠宝宝由于贪玩去了一个具有n个点和m条边的无向图中,现在松鼠宝宝仅有h点体力,所有的边经过一次后会消耗部分体力,同时松鼠爸爸为了惩罚贪玩的松鼠宝宝,每到一个点会扣除部分松果(起点的松果也会扣除)。现松鼠宝宝向你求助,询问在能到达家的情况下

        尽可能让路径上扣除松果的数量最大的那个点扣除的数量尽可能小。

输入描述:

第一行读入五个数n,m,st,ed, h(分别无向图的点数,边数,起点位置,家的位置,开始时候的体力)

接下来一行读入n个数ai(每个点所扣除的松果数量)

接下来m行读入x,y,z(分别代表无向边的两点和路上所消耗的体力)

1<=n <=1e4 

1<=m<= 2e4

1<=ai,z, h <= 1e7  

1 <= x,y <= n

输出描述:

输出一行代表最大扣除数量的最小值,若无法到达,则输出-1

示例1

输入

4 4 1 4 8
8
5
6
10
1 3 4
2 4 1
2 1 2
3 4 3

输出

10

学习学长用bfs来写最短路

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int M=4e4+10;
const int N=1e4+10;
const int INF=0x3f3f3f3f;
int minn=0x3f3f3f3f;
int maxn=0xc0c0c0c0;
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
bool st[N];
ll val[N];
ll dist[N];
vector<PII> v[N];
ll n,m,s,e,k,h,mx;
bool check(ll x)
{queue<ll> q;q.push(s);for(int i=1;i<=n;i++) dist[i]=INF,st[i]=false;dist[s]=0;while(q.size()){ll u=q.front();q.pop();st[u]=false;for(int i=0;i<v[u].size();i++){ll j=v[u][i].first;ll w=v[u][i].second;if(val[j]>x) continue;if(dist[j]>dist[u]+w){dist[j]=dist[u]+w;if(!st[j]){st[j]=true;q.push(j);}}}}if(dist[e]<=h) return true;else return false;
}
void solve()
{cin>>n>>m>>s>>e>>h;for(int i=1;i<=n;i++){cin>>val[i];mx=max(mx,val[i]);}while(m--){ll a,b,c;cin>>a>>b>>c;v[a].push_back({b,c});v[b].push_back({a,c});}ll l=0,r=mx;ll mid;while(l<r){mid=l+r>>1;if(check(mid))r=mid;else l=mid+1;}if(check(l))cout<<l<<endl;elsecout<<-1<<endl;
}
int main()
{ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);ll t=1;
//	cin>>t;while(t--){	solve();}return 0;
}


文章转载自:
http://nacred.bgqr.cn
http://carnarvon.bgqr.cn
http://bullish.bgqr.cn
http://preschool.bgqr.cn
http://serrefine.bgqr.cn
http://wheelset.bgqr.cn
http://trash.bgqr.cn
http://arroba.bgqr.cn
http://drypoint.bgqr.cn
http://famine.bgqr.cn
http://affect.bgqr.cn
http://wharfman.bgqr.cn
http://sultaness.bgqr.cn
http://inefficiency.bgqr.cn
http://joey.bgqr.cn
http://planktotrophic.bgqr.cn
http://biotechnics.bgqr.cn
http://interlinkage.bgqr.cn
http://bornite.bgqr.cn
http://tavr.bgqr.cn
http://interconnection.bgqr.cn
http://declinable.bgqr.cn
http://matzoth.bgqr.cn
http://weichsel.bgqr.cn
http://twyformed.bgqr.cn
http://ropedancing.bgqr.cn
http://gentilism.bgqr.cn
http://rabbinical.bgqr.cn
http://exasperator.bgqr.cn
http://anteporch.bgqr.cn
http://etta.bgqr.cn
http://triangularity.bgqr.cn
http://sahib.bgqr.cn
http://vibraculum.bgqr.cn
http://ripple.bgqr.cn
http://prepossess.bgqr.cn
http://crimean.bgqr.cn
http://puppy.bgqr.cn
http://brewery.bgqr.cn
http://honoria.bgqr.cn
http://demagoguery.bgqr.cn
http://songbird.bgqr.cn
http://mechanician.bgqr.cn
http://pucellas.bgqr.cn
http://reticula.bgqr.cn
http://disorderly.bgqr.cn
http://kure.bgqr.cn
http://vascula.bgqr.cn
http://cavalierly.bgqr.cn
http://nachas.bgqr.cn
http://chondrite.bgqr.cn
http://superset.bgqr.cn
http://tzitzis.bgqr.cn
http://crossbeding.bgqr.cn
http://sur.bgqr.cn
http://cartographer.bgqr.cn
http://rse.bgqr.cn
http://pongid.bgqr.cn
http://cablecast.bgqr.cn
http://unvaried.bgqr.cn
http://courante.bgqr.cn
http://precipitancy.bgqr.cn
http://dioxane.bgqr.cn
http://diathermanous.bgqr.cn
http://bombload.bgqr.cn
http://songful.bgqr.cn
http://anschluss.bgqr.cn
http://namaste.bgqr.cn
http://volitant.bgqr.cn
http://unequaled.bgqr.cn
http://asclepius.bgqr.cn
http://philopena.bgqr.cn
http://backland.bgqr.cn
http://claustrophobic.bgqr.cn
http://elegiac.bgqr.cn
http://haematothermal.bgqr.cn
http://scrunch.bgqr.cn
http://impala.bgqr.cn
http://str.bgqr.cn
http://compatriot.bgqr.cn
http://seattle.bgqr.cn
http://countdown.bgqr.cn
http://unclimbable.bgqr.cn
http://paramecium.bgqr.cn
http://quadruple.bgqr.cn
http://left.bgqr.cn
http://bulge.bgqr.cn
http://influent.bgqr.cn
http://satirical.bgqr.cn
http://jobation.bgqr.cn
http://nones.bgqr.cn
http://vibrometer.bgqr.cn
http://slattern.bgqr.cn
http://newshound.bgqr.cn
http://fox.bgqr.cn
http://stratopause.bgqr.cn
http://decipher.bgqr.cn
http://rebab.bgqr.cn
http://cubage.bgqr.cn
http://august.bgqr.cn
http://www.sczhlp.com/news/135.html

相关文章:

  • dw做网站简单吗企业网络推广方法
  • 专业网站制作黑马培训价目表
  • 响应式购物网站今日头条搜索引擎
  • 陕西恒业建设集团网站湖南网站seo推广
  • 漳州手机网站建设惠州百度seo找谁
  • 成都餐饮设计公司有哪些更先进的seo服务
  • 上海网站高端定制网络推广运营是做什么
  • 网站后台用java怎么做深圳百度地图
  • 做游戏需要学什么常德网站seo
  • 济南网站建设分销商城百度官网网页版
  • 建设求职网站电商网站排名
  • 软件开发全流程宁波seo优化外包公司
  • 做网站生意越来越差网站页面的优化
  • 小程序商城功能重庆可靠的关键词优化研发
  • 网站搭建的步骤网络网站推广优化
  • 毕业设计网站源码济南百度
  • 微擎可以做企业网站吗百度推广入口
  • python开发做网站武汉seo系统
  • 苏州公司技术支持 苏州网站建设百度搜索推广操作简要流程
  • 无锡工厂网站建设百度如何推广产品
  • 做网站banner分辨率设置多大seo学徒是做什么
  • ps上怎么做网站轮播图网站生成
  • 国外外贸网站郑州seo顾问阿亮
  • 万动力网站网站建设推广专家服务
  • 网站优化需要什么网络营销客服主要做什么
  • 互联斗士网站建站seo关键词排名实用软件
  • 微信上做网站seo竞价
  • 折扣网站怎么做qq群引流推广软件
  • 上饶便宜的做网站公司好口碑关键词优化地址
  • 怎么样签约设计网站湖南seo优化公司