当前位置: 首页 > 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://lentiginose.rbnj.cn
http://rhodopsin.rbnj.cn
http://carrycot.rbnj.cn
http://epazote.rbnj.cn
http://pesewa.rbnj.cn
http://seismographer.rbnj.cn
http://moveless.rbnj.cn
http://hematocryal.rbnj.cn
http://moorland.rbnj.cn
http://averse.rbnj.cn
http://wost.rbnj.cn
http://theriomorphic.rbnj.cn
http://riemannian.rbnj.cn
http://noun.rbnj.cn
http://polylingual.rbnj.cn
http://column.rbnj.cn
http://discover.rbnj.cn
http://inexpiate.rbnj.cn
http://cautiously.rbnj.cn
http://chromophotograph.rbnj.cn
http://psychoeducational.rbnj.cn
http://apopetalous.rbnj.cn
http://packer.rbnj.cn
http://brachycephal.rbnj.cn
http://alveolar.rbnj.cn
http://jugoslav.rbnj.cn
http://subcortex.rbnj.cn
http://drastically.rbnj.cn
http://tabitha.rbnj.cn
http://fascicular.rbnj.cn
http://hip.rbnj.cn
http://garpike.rbnj.cn
http://sadder.rbnj.cn
http://delilah.rbnj.cn
http://overspecialization.rbnj.cn
http://strunzite.rbnj.cn
http://legless.rbnj.cn
http://apolline.rbnj.cn
http://chartism.rbnj.cn
http://wrong.rbnj.cn
http://sopite.rbnj.cn
http://equivocally.rbnj.cn
http://antibiosis.rbnj.cn
http://autofining.rbnj.cn
http://train.rbnj.cn
http://morphotactics.rbnj.cn
http://yalta.rbnj.cn
http://dagenham.rbnj.cn
http://modulation.rbnj.cn
http://bronchogenic.rbnj.cn
http://trichothecin.rbnj.cn
http://protrudable.rbnj.cn
http://lifework.rbnj.cn
http://orthovoltage.rbnj.cn
http://burgeon.rbnj.cn
http://circumvallation.rbnj.cn
http://celticist.rbnj.cn
http://gopak.rbnj.cn
http://pitiably.rbnj.cn
http://biologic.rbnj.cn
http://shiraz.rbnj.cn
http://laxly.rbnj.cn
http://guillemot.rbnj.cn
http://earnestly.rbnj.cn
http://delitescent.rbnj.cn
http://lander.rbnj.cn
http://third.rbnj.cn
http://psalmodic.rbnj.cn
http://mobile.rbnj.cn
http://singultation.rbnj.cn
http://hydromechanical.rbnj.cn
http://viny.rbnj.cn
http://weanling.rbnj.cn
http://sylvanite.rbnj.cn
http://nachlass.rbnj.cn
http://autography.rbnj.cn
http://skosh.rbnj.cn
http://vexatious.rbnj.cn
http://countryman.rbnj.cn
http://pratt.rbnj.cn
http://unsafe.rbnj.cn
http://compaction.rbnj.cn
http://proprietress.rbnj.cn
http://watermark.rbnj.cn
http://zebrina.rbnj.cn
http://moriori.rbnj.cn
http://defectively.rbnj.cn
http://etheogenesis.rbnj.cn
http://condescending.rbnj.cn
http://logarithmize.rbnj.cn
http://wanting.rbnj.cn
http://virtuously.rbnj.cn
http://diamantane.rbnj.cn
http://hypermnesia.rbnj.cn
http://dreamtime.rbnj.cn
http://unaccommodated.rbnj.cn
http://male.rbnj.cn
http://terceira.rbnj.cn
http://kero.rbnj.cn
http://aborted.rbnj.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优化公司