计蒜客习题:骑车比赛
题目

样例

思路
Dij简单应用,不再赘述。
代码
#include<iostream>
#include<cstring>
using namespace std;
const int MAX_N = 10000;
const int MAX_M = 100000;
const int inf = 0x3f3f3f3f;
struct edge {
int v, w, next;
} e[MAX_M];
int p[MAX_N], eid, n,m;
void mapinit() {
memset(p, -1, sizeof(p