小雨坐地铁 (分层最短路&建立虚点) 思路:建立一个虚点层,题目等价于求虚点层起点到终点的最小花费。同一层边花费b,虚点层到其他每层花费a。跑一边dijkstra即可。 AC代码: #include<bits/stdc++.h> using namespace std; const int N=1e6+5,inf=0x3f3f3f3f; struct edge{ int to,nt,w; }e[N]; int h[N],n,m,d[N],cnt=1,st,ed,vis[N]; struct node{ int d,id; bool operator<(const no...