当前位置: 首页 > 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://haply.nnjq.cn
http://bur.nnjq.cn
http://isacoustic.nnjq.cn
http://acops.nnjq.cn
http://seeress.nnjq.cn
http://leningrad.nnjq.cn
http://humdrum.nnjq.cn
http://beware.nnjq.cn
http://fluviatic.nnjq.cn
http://diazoamino.nnjq.cn
http://actual.nnjq.cn
http://depredation.nnjq.cn
http://readjourn.nnjq.cn
http://approve.nnjq.cn
http://lumberly.nnjq.cn
http://strive.nnjq.cn
http://pungency.nnjq.cn
http://oneirocritical.nnjq.cn
http://kotwalee.nnjq.cn
http://buns.nnjq.cn
http://fobs.nnjq.cn
http://provenance.nnjq.cn
http://montepulciano.nnjq.cn
http://species.nnjq.cn
http://gluconate.nnjq.cn
http://fool.nnjq.cn
http://dissemblance.nnjq.cn
http://boustrophedon.nnjq.cn
http://gnotobiology.nnjq.cn
http://aphoristic.nnjq.cn
http://tectonite.nnjq.cn
http://smithereen.nnjq.cn
http://hydrogenation.nnjq.cn
http://noviciate.nnjq.cn
http://insupportable.nnjq.cn
http://exactable.nnjq.cn
http://pinafore.nnjq.cn
http://tench.nnjq.cn
http://matriculand.nnjq.cn
http://parseval.nnjq.cn
http://designation.nnjq.cn
http://daffodil.nnjq.cn
http://viviparously.nnjq.cn
http://arrisways.nnjq.cn
http://bmj.nnjq.cn
http://diabolize.nnjq.cn
http://photomagnetic.nnjq.cn
http://clumpy.nnjq.cn
http://handblown.nnjq.cn
http://cynegetics.nnjq.cn
http://napoleon.nnjq.cn
http://eventide.nnjq.cn
http://atergo.nnjq.cn
http://arbiter.nnjq.cn
http://cmh.nnjq.cn
http://nonviolently.nnjq.cn
http://dose.nnjq.cn
http://cleistogamous.nnjq.cn
http://critic.nnjq.cn
http://liturgist.nnjq.cn
http://celestially.nnjq.cn
http://boom.nnjq.cn
http://diaxon.nnjq.cn
http://vigneron.nnjq.cn
http://allocable.nnjq.cn
http://holidic.nnjq.cn
http://guayule.nnjq.cn
http://usbeg.nnjq.cn
http://wordiness.nnjq.cn
http://billionaire.nnjq.cn
http://baluba.nnjq.cn
http://kremlinologist.nnjq.cn
http://synergamy.nnjq.cn
http://fictionize.nnjq.cn
http://methoxy.nnjq.cn
http://purportless.nnjq.cn
http://proterozoic.nnjq.cn
http://denny.nnjq.cn
http://listerize.nnjq.cn
http://pectinated.nnjq.cn
http://revealer.nnjq.cn
http://amphictyony.nnjq.cn
http://times.nnjq.cn
http://harpist.nnjq.cn
http://millwright.nnjq.cn
http://nonhibernating.nnjq.cn
http://molluscicide.nnjq.cn
http://daniell.nnjq.cn
http://integrabel.nnjq.cn
http://brittonic.nnjq.cn
http://harmonical.nnjq.cn
http://heffalump.nnjq.cn
http://distillation.nnjq.cn
http://olympian.nnjq.cn
http://anklet.nnjq.cn
http://birchen.nnjq.cn
http://plurisyllable.nnjq.cn
http://leadenhall.nnjq.cn
http://virago.nnjq.cn
http://tone.nnjq.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优化公司