rt
代码交到hdu的时候显示
0_0_36199519_17461.cpp
0_0_36199519_17461.cpp(1) : fatal error C1083: 无法打开包括文件: “bits/stdc++.h”: No such file or directory
然而本地编译是可以通过的,所以是什么问题啊/kk
代码:
#include<bits/stdc++.h>
using namespace std;
int t,n,m,x,y,z,k,ans,vv,num,p[100005],f[100005],to[100005],val[100005],next[100005];
bool flag[100005];
string s;
struct nord
{
int id,v;
bool operator< (const nord &a) const
{
return v>a.v;
}
}head;
priority_queue<nord> q;
void add(int x,int y,int z)
{
to[++num]=y;
val[num]=z;
next[num]=f[x];
f[x]=num;
}
int main()
{
//freopen("jroad.in","r",stdin);
//freopen("jroad.out","w",stdout);
ios::sync_with_stdio(false);
while(cin>>n)
{
if(n==0) return 0;
memset(flag,0,sizeof(flag));
memset(f,0,sizeof(f));
num=ans=0;
for(int i=1;i<n;++i)
{
cin>>s;
x=s[0]-'A'+1;
cin>>m;
for(int j=1;j<=m;++j)
{
cin>>s;
y=s[0]-'A'+1;
cin>>z;
add(x,y,z);add(y,x,z);
}
}
memset(p,0x3f,sizeof(p));
p[1]=0;head.id=1;head.v=0;
q.push(head);
while(!q.empty())
{
head=q.top();q.pop();
if(flag[head.id]) continue;
ans+=head.v;
flag[head.id]=true;
for(int i=f[head.id];i;i=next[i])
{
k=to[i];vv=val[i];
if(!flag[k]&&p[k]>vv){p[k]=vv;q.push(nord{k,p[k]});}
}
}
cout<<ans<<endl;
}
return 0;
}
各位聚聚帮忙看一看吧qwq