@[tan_gent](/space/show?uid=31728)
您会用链式前向星吗?
by Jelly_Goat @ 2019-05-10 20:56:19
这个题会给一些重边和自环,所以需要用到链式前向星
by Jelly_Goat @ 2019-05-10 20:57:35
@[Jelly_Goat](/space/show?uid=122927) 会的,但是我想用临街矩阵
by si_zhong @ 2019-05-10 20:57:57
@[Jelly_Goat](/space/show?uid=122927) 但是我样例都没过
by si_zhong @ 2019-05-10 20:58:14
蒟蒻我也看不出来了......
光知道堆优化过的咋写了......Orz
by Jelly_Goat @ 2019-05-10 21:00:03
有重边是取最小那条而不是取最后那条
by SSerxhs @ 2019-05-10 21:02:58
@[SSerxhs](/space/show?uid=29826) 的确去了最小的那条啊
```cpp
for(int x=1;x<=n;x++){
if(d[x]<minn&&vis[x]==0){
minn=d[x];
minx=x;
}
}
vis[minx]=1;
```
by si_zhong @ 2019-05-10 21:04:03
@[tan_gent](/space/show?uid=31728)
```cpp
for(int i=1;i<=m;i++){
scanf("%d %d %d",&f,&g,&w);
a[f][g]=w;
}
```
您这个读入应该这样写
```cpp
for(int i=1;i<=m;i++){
scanf("%d %d %d",&f,&g,&w);
a[f][g]=min(a[f][g],w);
}
```
by Genius_Z @ 2019-05-10 21:07:25
@[Genius_Z](/space/show?uid=110271) 还是没过样例
by si_zhong @ 2019-05-10 21:10:39
@[tan_gent](/space/show?uid=31728)
```cpp
memset(a,2147483647,sizeof(a));
```
不能这么写吧……
我记得是
```cpp
memset(a,0x3f,sizeof(a));
```
(`memset`是每个字节都要赋一个两位十六进制数(刚好就是$0\sim 255$))
by info___tion @ 2019-05-10 21:11:57