@[醉了酒的李白](/space/show?uid=57634) memset 0x7f是把每八位设成0x7f,实际值是0x7f7f7f7f
by ouuan @ 2018-10-23 13:46:40
@[ouuan](/space/show?uid=49742) ?是这个问题么,是不是不能用memset初始化二维数组
by 醉了酒的李白 @ 2018-10-23 13:47:49
@[醉了酒的李白](/space/show?uid=57634) 可以啊,改成if(minm[i]>=0x7f7f7f7f)
by ouuan @ 2018-10-23 13:48:28
@[醉了酒的李白](/space/show?uid=57634) 你看看提交记录不是全orz吗...
by ouuan @ 2018-10-23 13:48:44
@[醉了酒的李白](/space/show?uid=57634) 为什么大于$0x7f$就要输出 $orz$ ?
$0x7f$ 挺小的,只有100多啊
by jzzcjb @ 2018-10-23 13:50:53
$0x7f=127$
by jzzcjb @ 2018-10-23 13:51:10
@[arfa](/space/show?uid=77760) 稀疏图几乎一样,稠密图不加堆的prim更优。
by ouuan @ 2018-10-23 13:51:12
@[ouuan](/space/show?uid=49742) 还是wa
by 醉了酒的李白 @ 2018-10-23 14:06:14
@[ouuan](/space/show?uid=49742) 脑阔痛
```cpp
#include<iostream>
#include<cstring>
using namespace std;
int n,m;
int tu[5010][5010];
int minm[5010];
bool bj[5010];
long long ans;
int main()
{
cin>>n>>m;
memset(tu,0x7f,sizeof(tu));
for(int i=1;i<=m;i++)
{
int x=0,y=0,z=0;
cin>>x>>y>>z;
tu[x][y]=tu[y][x]=z;
}
memset(minm,0x7f,sizeof(minm));
minm[1]=0;
for(int i=1;i<=n;i++)
{
int k=0;
for(int j=1;j<=n;j++)
if(!bj[j]&&minm[k]>minm[j])
k=j;
bj[k]=1;
for(int j=1;j<=n;j++)
if(minm[j]>tu[k][j]&&!bj[j])
minm[j]=tu[k][j];
}
for(int i=1;i<=n;i++)
if(minm[i]>=0x7f7f7f7f)
{
cout<<"orz";
return 0;
}
else
ans+=minm[i];
cout<<ans;
}
```
by 醉了酒的李白 @ 2018-10-23 14:07:04
@[醉了酒的李白](/space/show?uid=57634) 毒瘤题有重边..
```
cin>>x>>y>>z;
if (z<tu[x][y])
{
tu[x][y]=tu[y][x]=z;
}
```
by ouuan @ 2018-10-23 14:59:17