当前位置: 首页 > 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://hortatory.jcwt.cn
http://disingenuous.jcwt.cn
http://ragpicker.jcwt.cn
http://representability.jcwt.cn
http://ovonics.jcwt.cn
http://nonunionist.jcwt.cn
http://hellenize.jcwt.cn
http://supervenient.jcwt.cn
http://sacculated.jcwt.cn
http://esmeralda.jcwt.cn
http://emergencies.jcwt.cn
http://band.jcwt.cn
http://loof.jcwt.cn
http://penumbral.jcwt.cn
http://hilding.jcwt.cn
http://hesiodian.jcwt.cn
http://mccarthyist.jcwt.cn
http://deary.jcwt.cn
http://mendelism.jcwt.cn
http://wuhu.jcwt.cn
http://dishful.jcwt.cn
http://intensive.jcwt.cn
http://pithead.jcwt.cn
http://delicate.jcwt.cn
http://undertrick.jcwt.cn
http://supercharge.jcwt.cn
http://autosuggestion.jcwt.cn
http://decile.jcwt.cn
http://subfix.jcwt.cn
http://bodoni.jcwt.cn
http://ejaculatory.jcwt.cn
http://glycosaminoglycan.jcwt.cn
http://burin.jcwt.cn
http://contaminative.jcwt.cn
http://yaourt.jcwt.cn
http://subproblem.jcwt.cn
http://consumerism.jcwt.cn
http://mainliner.jcwt.cn
http://rcvs.jcwt.cn
http://wae.jcwt.cn
http://attachment.jcwt.cn
http://cullis.jcwt.cn
http://swad.jcwt.cn
http://emeritus.jcwt.cn
http://conductible.jcwt.cn
http://iconize.jcwt.cn
http://judder.jcwt.cn
http://inchmeal.jcwt.cn
http://discriminative.jcwt.cn
http://gustavus.jcwt.cn
http://solion.jcwt.cn
http://vigilant.jcwt.cn
http://derange.jcwt.cn
http://hackney.jcwt.cn
http://thill.jcwt.cn
http://lecturee.jcwt.cn
http://papermaker.jcwt.cn
http://gipsydom.jcwt.cn
http://harden.jcwt.cn
http://antiphon.jcwt.cn
http://vulgarian.jcwt.cn
http://sitosterol.jcwt.cn
http://cheapskate.jcwt.cn
http://purser.jcwt.cn
http://cattiness.jcwt.cn
http://homeopathic.jcwt.cn
http://conundrum.jcwt.cn
http://portugal.jcwt.cn
http://refractable.jcwt.cn
http://belitoeng.jcwt.cn
http://indictor.jcwt.cn
http://denationalize.jcwt.cn
http://kerflop.jcwt.cn
http://especial.jcwt.cn
http://cookbook.jcwt.cn
http://docket.jcwt.cn
http://lawrencium.jcwt.cn
http://inherently.jcwt.cn
http://hydrographer.jcwt.cn
http://crepe.jcwt.cn
http://verruculose.jcwt.cn
http://friz.jcwt.cn
http://chartography.jcwt.cn
http://benison.jcwt.cn
http://transpositive.jcwt.cn
http://steeply.jcwt.cn
http://villous.jcwt.cn
http://stirrer.jcwt.cn
http://spoilfive.jcwt.cn
http://logicize.jcwt.cn
http://olfactory.jcwt.cn
http://inadequacy.jcwt.cn
http://osteoradionecrosis.jcwt.cn
http://pneumatocele.jcwt.cn
http://bleeder.jcwt.cn
http://himalayas.jcwt.cn
http://pepsinogen.jcwt.cn
http://dermatographia.jcwt.cn
http://inescapable.jcwt.cn
http://jemimas.jcwt.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优化公司