0_0_22037254_8918.cpp:7:476: error: expected ';' after struct definition
using namespace std; int i,j,k,l,s,n,m,G[N],last[N],Next[M],val[M],to[M],tot,X,x[M],y[M],z,ans; int f[N]; int id[N],T[5][N]; inline void add(int x,int y,int z) { Next[++tot]=last[x]; last[x]=tot; to[tot]=y; val[tot]=z; } struct node { int dis[N],q[N*20],e[N],ans[N]; inline void spfa(int x) { int l=0,r=1; for (int i=1;i<=n;i++) dis[i]=inf,ans[i]=e[i]=0; e[q[1]=x]=1; dis[x]=0; while (ldis[k]+val[i]) { dis[to[i]]=dis[k]+val[i]; if (!e[to[i]]) e[q[++r]=to[i]]=1; } e[k]=0; } } }A,B; inline bool Acmp(int x,int y) { return A.dis[x]B.dis[y]; } inline bool cmp3(int x,int y) { return A.ans[x]>A.ans[y]; } inline bool cmp4(int x,int y) { return B.ans[x]B.e[y]; } inline void change(int x,int y) { for (;x;x-=lowbit(x)) f[x]+=y; } inline int ask(int x) { int s=0; for (;x<=n;x+=lowbit(x)) s+=f[x]; return s; } int main() { while (scanf("%d%d",&n,&m)!=EOF) { if (!(n+m)) return 0; scanf("%d",&X); for (i=1;i<=m;i++) { scanf("%d%d%d",&x[i],&y[i],&z); add(x[i],y[i],z),add(y[i],x[i],z); } A.spfa(1),B.spfa(n); for (i=1;i<=n;i++) id[i]=i; sort(id+1,id+1+n,Acmp); A.ans[id[1]]=1; for (i=1;i<=n;i++) for (j=last[id[i]];j;j=Next[j]) if (A.dis[id[i]]==A.dis[to[j]]+val[j]) A.ans[id[i]]+=A.ans[to[j]]; sort(id+1,id+1+n,Bcmp); B.ans[id[1]]=1; for (i=1;i<=n;i++) for (j=last[id[i]];j;j=Next[j]) if (B.dis[id[i]]==B.dis[to[j]]+val[j]) B.ans[id[i]]+=B.ans[to[j]]; for (i=1;i<=n;i++) for (j=1;j<=4;j++) T[j][i]=i; sort(T[1]+1,T[1]+n+1,cmp1); sort(T[2]+1,T[2]+n+1,cmp2); j=1; for (i=1;i<=n;i++) { while (j<=n&&A.dis[T[1][i]]+B.dis[T[2][j]]>=A.dis[n]) j++; A.e[T[1][i]]=j; } j=1; sort(T[3]+1,T[3]+n+1,cmp3); sort(T[4]+1,T[4]+n+1,cmp4); for (i=1;i<=n;i++) { while (j<=n&&X>1ll*A.ans[T[3][i]]*B.ans[T[4][j]]) j++; B.e[T[3][i]]=j; } for (i=1;i<=n;i++) G[T[2][i]]=i; sort(id+1,id+1+n,cmp5); j=n; for (i=1;i<=n;i++) { while (j>=B.e[id[i]]) change(G[T[4][j]],1),j--; ans+=ask(A.e[id[i]]); } for (j=j+1;j<=n;j++) change(G[T[4][j]],-1); for (i=1;i<=m;i++) { if (A.dis[x[i]]+B.dis[y[i]]=X) ans--; swap(x[i],y[i]); if (A.dis[x[i]]+B.dis[y[i]]=X) ans--; }
^
0_0_22037254_8918.cpp: In member function 'void node::spfa(int)':
0_0_22037254_8918.cpp:7:386: error: 'ldis' was not declared in this scope
using namespace std; int i,j,k,l,s,n,m,G[N],last[N],Next[M],val[M],to[M],tot,X,x[M],y[M],z,ans; int f[N]; int id[N],T[5][N]; inline void add(int x,int y,int z) { Next[++tot]=last[x]; last[x]=tot; to[tot]=y; val[tot]=z; } struct node { int dis[N],q[N*20],e[N],ans[N]; inline void spfa(int x) { int l=0,r=1; for (int i=1;i<=n;i++) dis[i]=inf,ans[i]=e[i]=0; e[q[1]=x]=1; dis[x]=0; while (ldis[k]+val[i]) { dis[to[i]]=dis[k]+val[i]; if (!e[to[i]]) e[q[++r]=to[i]]=1; } e[k]=0; } } }A,B; inline bool Acmp(int x,int y) { return A.dis[x]B.dis[y]; } inline bool cmp3(int x,int y) { return A.ans[x]>A.ans[y]; } inline bool cmp4(int x,int y) { return B.ans[x]B.e[y]; } inline void change(int x,int y) { for (;x;x-=lowbit(x)) f[x]+=y; } inline int ask(int x) { int s=0; for (;x<=n;x+=lowbit(x)) s+=f[x]; return s; } int main() { while (scanf("%d%d",&n,&m)!=EOF) { if (!(n+m)) return 0; scanf("%d",&X); for (i=1;i<=m;i++) { scanf("%d%d%d",&x[i],&y[i],&z); add(x[i],y[i],z),add(y[i],x[i],z); } A.spfa(1),B.spfa(n); for (i=1;i<=n;i++) id[i]=i; sort(id+1,id+1+n,Acmp); A.ans[id[1]]=1; for (i=1;i<=n;i++) for (j=last[id[i]];j;j=Next[j]) if (A.dis[id[i]]==A.dis[to[j]]+val[j]) A.ans[id[i]]+=A.ans[to[j]]; sort(id+1,id+1+n,Bcmp); B.ans[id[1]]=1; for (i=1;i<=n;i++) for (j=last[id[i]];j;j=Next[j]) if (B.dis[id[i]]==B.dis[to[j]]+val[j]) B.ans[id[i]]+=B.ans[to[j]]; for (i=1;i<=n;i++) for (j=1;j<=4;j++) T[j][i]=i; sort(T[1]+1,T[1]+n+1,cmp1); sort(T[2]+1,T[2]+n+1,cmp2); j=1; for (i=1;i<=n;i++) { while (j<=n&&A.dis[T[1][i]]+B.dis[T[2][j]]>=A.dis[n]) j++; A.e[T[1][i]]=j; } j=1; sort(T[3]+1,T[3]+n+1,cmp3); sort(T[4]+1,T[4]+n+1,cmp4); for (i=1;i<=n;i++) { while (j<=n&&X>1ll*A.ans[T[3][i]]*B.ans[T[4][j]]) j++; B.e[T[3][i]]=j; } for (i=1;i<=n;i++) G[T[2][i]]=i; sort(id+1,id+1+n,cmp5); j=n; for (i=1;i<=n;i++) { while (j>=B.e[id[i]]) change(G[T[4][j]],1),j--; ans+=ask(A.e[id[i]]); } for (j=j+1;j<=n;j++) change(G[T[4][j]],-1); for (i=1;i<=m;i++) { if (A.dis[x[i]]+B.dis[y[i]]=X) ans--; swap(x[i],y[i]); if (A.dis[x[i]]+B.dis[y[i]]=X) ans--; }
^
0_0_22037254_8918.cpp: At global scope:
0_0_22037254_8918.cpp:7:478: error: expected declaration before '}' token
using namespace std; int i,j,k,l,s,n,m,G[N],last[N],Next[M],val[M],to[M],tot,X,x[M],y[M],z,ans; int f[N]; int id[N],T[5][N]; inline void add(int x,int y,int z) { Next[++tot]=last[x]; last[x]=tot; to[tot]=y; val[tot]=z; } struct node { int dis[N],q[N*20],e[N],ans[N]; inline void spfa(int x) { int l=0,r=1; for (int i=1;i<=n;i++) dis[i]=inf,ans[i]=e[i]=0; e[q[1]=x]=1; dis[x]=0; while (ldis[k]+val[i]) { dis[to[i]]=dis[k]+val[i]; if (!e[to[i]]) e[q[++r]=to[i]]=1; } e[k]=0; } } }A,B; inline bool Acmp(int x,int y) { return A.dis[x]B.dis[y]; } inline bool cmp3(int x,int y) { return A.ans[x]>A.ans[y]; } inline bool cmp4(int x,int y) { return B.ans[x]B.e[y]; } inline void change(int x,int y) { for (;x;x-=lowbit(x)) f[x]+=y; } inline int ask(int x) { int s=0; for (;x<=n;x+=lowbit(x)) s+=f[x]; return s; } int main() { while (scanf("%d%d",&n,&m)!=EOF) { if (!(n+m)) return 0; scanf("%d",&X); for (i=1;i<=m;i++) { scanf("%d%d%d",&x[i],&y[i],&z); add(x[i],y[i],z),add(y[i],x[i],z); } A.spfa(1),B.spfa(n); for (i=1;i<=n;i++) id[i]=i; sort(id+1,id+1+n,Acmp); A.ans[id[1]]=1; for (i=1;i<=n;i++) for (j=last[id[i]];j;j=Next[j]) if (A.dis[id[i]]==A.dis[to[j]]+val[j]) A.ans[id[i]]+=A.ans[to[j]]; sort(id+1,id+1+n,Bcmp); B.ans[id[1]]=1; for (i=1;i<=n;i++) for (j=last[id[i]];j;j=Next[j]) if (B.dis[id[i]]==B.dis[to[j]]+val[j]) B.ans[id[i]]+=B.ans[to[j]]; for (i=1;i<=n;i++) for (j=1;j<=4;j++) T[j][i]=i; sort(T[1]+1,T[1]+n+1,cmp1); sort(T[2]+1,T[2]+n+1,cmp2); j=1; for (i=1;i<=n;i++) { while (j<=n&&A.dis[T[1][i]]+B.dis[T[2][j]]>=A.dis[n]) j++; A.e[T[1][i]]=j; } j=1; sort(T[3]+1,T[3]+n+1,cmp3); sort(T[4]+1,T[4]+n+1,cmp4); for (i=1;i<=n;i++) { while (j<=n&&X>1ll*A.ans[T[3][i]]*B.ans[T[4][j]]) j++; B.e[T[3][i]]=j; } for (i=1;i<=n;i++) G[T[2][i]]=i; sort(id+1,id+1+n,cmp5); j=n; for (i=1;i<=n;i++) { while (j>=B.e[id[i]]) change(G[T[4][j]],1),j--; ans+=ask(A.e[id[i]]); } for (j=j+1;j<=n;j++) change(G[T[4][j]],-1); for (i=1;i<=m;i++) { if (A.dis[x[i]]+B.dis[y[i]]=X) ans--; swap(x[i],y[i]); if (A.dis[x[i]]+B.dis[y[i]]=X) ans--; }
^
|