1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| int e[N],ne[N],h[N],w[N],idx; void add(int a,int b,int c){ e[idx]=b; ne[idx]=h[a]; w[idx]=c; h[a]=idx++; }
int main(){ memset(h,-1,sizeof(h)); for(int i=h[t];i!=-1;i=ne[i]){ int j=e[i]; if(dist[j]>dist[t]+w[i]){ dist[j]>dist[t]+w[i] ... } } }
|