从某个城市到另一个城市,会遭到联盟的攻击,进而损失一定的血量。
这里血量相当于两点之间边的长度
每次经过一个城市,都会被收取一定的过路费(包括起点和终点)
过路费相当于点的权值
在可以到达奥格瑞玛的情况下,他所经过的所有城市中 最多的一次收取的费用 的最小值是多少
这道题其实是,只要能苟到奥格瑞玛就行,哪怕血量只剩1都行。然后费用也不是看总和,而是看单次交费的最大值。
比如 路径A:1-3-4-5 的收费分别是1,3,3,1, B:1-2-5 的收费分别是1,4,1,这时候他会选择走A
链式向前星+Dijkstra和DFS的结合体??(66msO2)
#include <bits/stdc++.h>
using namespace std;
inline void inn(int & x) {
int f = 1; x = 0;
char ch = getchar();
while (ch < '0' || ch > '9') {
if (ch == '-') f = -1; ch = getchar();}
while (ch >= '0' && ch <= '9') {
x = x * 10 + ch - '0'; ch = getchar();}
x *= f;
}
int V,E,b,cnt,f[10010];
struct edge{
//边,h是血量
int to,next,h;
}ed[100010];
int head[10010];
struct node{
//点,h是剩余血量
int num,cost,h;
friend bool operator < (node a ,node b){
return a.cost>b.cost;
}
} nodes[10010] ;
inline void addedge(int from,int to,int h){
ed[++cnt].h=h;
ed[cnt].next=head[from];
ed[cnt].to=to;
head[from]=cnt;
}
inline int dij_dfs(