写了两年半,发现锅出在这里:
memset(dist, 0x3f, sizeof(dist));
……
想想为什么
直接这么写才行:
for(int i=1; i<=n; i++)dist[i]=INF;