题目链接:ZOJ
题面:
题意:有n个地方(0-n, 0为首都),现在有m条双向路,每条路有一个造价和通过时间,问如果造路使通过时间少的同时,造假尽可能小
思路:让通过时间小就是单源最短路(dij),我们再求最短路的时候可以求出在已有路径中添加一个节点的花费(就是在保证在到这个节点时间最短的情况下找一个花费最小的路),然后每个点累加
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define N 100005
#define M 200005
struct node{
int id;
ll w;
ll c;
};
int h[N];
int to[M];
int nex[M];
ll w[M];
ll c[M];
ll s[N];
ll ss[N]; //存的是连通到这个点的这条路的最小花费
int cnt;
bool vis[N];
struct cmp{
bool operator()(node a, node