0_0_20612567_32730.cpp:5:25: error: stray '#' in program
using namespace std;#define maxn 200010struct node{ int u,v,w;}edge[maxn];int parent[maxn];int n,m,ans,sum;int cmp(const node &p,const node &q){ return p.w<q.w;}int Find(int x){ int i; for(i=x;parent[i]>=0;i=parent[i]) ; while(i!=x){ int tmp=parent[x]; parent[x]=i; x=tmp; } return i;}void Union(int x,int y){ int r1=Find(x),r2=Find(y); if(r1==r2) return; if(parent[r1]<parent[r2]){ parent[r1]+=parent[r2]; parent[r2]=r1; }else { parent[r2]+=parent[r1]; parent[r1]=r2; }}int Kruskal(){ int s=0; for(int i=0;i<m;i++){ int u=edge[i].u,v=edge[i].v,w=edge[i].w; if(Find(u)!=Find(v)){ s+=w; Union(u,v); } } return s; }int main(){ while(~scanf("%d %d",&n,&m)&&m+n){ memset(parent,-1,sizeof(parent)); ans=0; for(int i=0;i<m;i++){ scanf("%d %d %d",&edge[i].u,&edge[i].v,&edge[i].w); ans+=edge[i].w; } sort(edge,edge+m,cmp); sum=Kruskal(); printf("%d\n",ans-sum); } return 0;}
^
0_0_20612567_32730.cpp:5:26: error: 'define' does not name a type
using namespace std;#define maxn 200010struct node{ int u,v,w;}edge[maxn];int parent[maxn];int n,m,ans,sum;int cmp(const node &p,const node &q){ return p.w<q.w;}int Find(int x){ int i; for(i=x;parent[i]>=0;i=parent[i]) ; while(i!=x){ int tmp=parent[x]; parent[x]=i; x=tmp; } return i;}void Union(int x,int y){ int r1=Find(x),r2=Find(y); if(r1==r2) return; if(parent[r1]<parent[r2]){ parent[r1]+=parent[r2]; parent[r2]=r1; }else { parent[r2]+=parent[r1]; parent[r1]=r2; }}int Kruskal(){ int s=0; for(int i=0;i<m;i++){ int u=edge[i].u,v=edge[i].v,w=edge[i].w; if(Find(u)!=Find(v)){ s+=w; Union(u,v); } } return s; }int main(){ while(~scanf("%d %d",&n,&m)&&m+n){ memset(parent,-1,sizeof(parent)); ans=0; for(int i=0;i<m;i++){ scanf("%d %d %d",&edge[i].u,&edge[i].v,&edge[i].w); ans+=edge[i].w; } sort(edge,edge+m,cmp); sum=Kruskal(); printf("%d\n",ans-sum); } return 0;}
^
0_0_20612567_32730.cpp:5:69: error: 'edge' does not name a type
using namespace std;#define maxn 200010struct node{ int u,v,w;}edge[maxn];int parent[maxn];int n,m,ans,sum;int cmp(const node &p,const node &q){ return p.w<q.w;}int Find(int x){ int i; for(i=x;parent[i]>=0;i=parent[i]) ; while(i!=x){ int tmp=parent[x]; parent[x]=i; x=tmp; } return i;}void Union(int x,int y){ int r1=Find(x),r2=Find(y); if(r1==r2) return; if(parent[r1]<parent[r2]){ parent[r1]+=parent[r2]; parent[r2]=r1; }else { parent[r2]+=parent[r1]; parent[r1]=r2; }}int Kruskal(){ int s=0; for(int i=0;i<m;i++){ int u=edge[i].u,v=edge[i].v,w=edge[i].w; if(Find(u)!=Find(v)){ s+=w; Union(u,v); } } return s; }int main(){ while(~scanf("%d %d",&n,&m)&&m+n){ memset(parent,-1,sizeof(parent)); ans=0; for(int i=0;i<m;i++){ scanf("%d %d %d",&edge[i].u,&edge[i].v,&edge[i].w); ans+=edge[i].w; } sort(edge,edge+m,cmp); sum=Kruskal(); printf("%d\n",ans-sum); } return 0;}
^
0_0_20612567_32730.cpp:5:91: error: 'maxn' was not declared in this scope
using namespace std;#define maxn 200010struct node{ int u,v,w;}edge[maxn];int parent[maxn];int n,m,ans,sum;int cmp(const node &p,const node &q){ return p.w<q.w;}int Find(int x){ int i; for(i=x;parent[i]>=0;i=parent[i]) ; while(i!=x){ int tmp=parent[x]; parent[x]=i; x=tmp; } return i;}void Union(int x,int y){ int r1=Find(x),r2=Find(y); if(r1==r2) return; if(parent[r1]<parent[r2]){ parent[r1]+=parent[r2]; parent[r2]=r1; }else { parent[r2]+=parent[r1]; parent[r1]=r2; }}int Kruskal(){ int s=0; for(int i=0;i<m;i++){ int u=edge[i].u,v=edge[i].v,w=edge[i].w; if(Find(u)!=Find(v)){ s+=w; Union(u,v); } } return s; }int main(){ while(~scanf("%d %d",&n,&m)&&m+n){ memset(parent,-1,sizeof(parent)); ans=0; for(int i=0;i<m;i++){ scanf("%d %d %d",&edge[i].u,&edge[i].v,&edge[i].w); ans+=edge[i].w; } sort(edge,edge+m,cmp); sum=Kruskal(); printf("%d\n",ans-sum); } return 0;}
^
0_0_20612567_32730.cpp:5:127: error: 'node' does not name a type
using namespace std;#define maxn 200010struct node{ int u,v,w;}edge[maxn];int parent[maxn];int n,m,ans,sum;int cmp(const node &p,const node &q){ return p.w<q.w;}int Find(int x){ int i; for(i=x;parent[i]>=0;i=parent[i]) ; while(i!=x){ int tmp=parent[x]; parent[x]=i; x=tmp; } return i;}void Union(int x,int y){ int r1=Find(x),r2=Find(y); if(r1==r2) return; if(parent[r1]<parent[r2]){ parent[r1]+=parent[r2]; parent[r2]=r1; }else { parent[r2]+=parent[r1]; parent[r1]=r2; }}int Kruskal(){ int s=0; for(int i=0;i<m;i++){ int u=edge[i].u,v=edge[i].v,w=edge[i].w; if(Find(u)!=Find(v)){ s+=w; Union(u,v); } } return s; }int main(){ while(~scanf("%d %d",&n,&m)&&m+n){ memset(parent,-1,sizeof(parent)); ans=0; for(int i=0;i<m;i++){ scanf("%d %d %d",&edge[i].u,&edge[i].v,&edge[i].w); ans+=edge[i].w; } sort(edge,edge+m,cmp); sum=Kruskal(); printf("%d\n",ans-sum); } return 0;}
^
0_0_20612567_32730.cpp:5:141: error: 'node' does not name a type
using namespace std;#define maxn 200010struct node{ int u,v,w;}edge[maxn];int parent[maxn];int n,m,ans,sum;int cmp(const node &p,const node &q){ return p.w<q.w;}int Find(int x){ int i; for(i=x;parent[i]>=0;i=parent[i]) ; while(i!=x){ int tmp=parent[x]; parent[x]=i; x=tmp; } return i;}void Union(int x,int y){ int r1=Find(x),r2=Find(y); if(r1==r2) return; if(parent[r1]<parent[r2]){ parent[r1]+=parent[r2]; parent[r2]=r1; }else { parent[r2]+=parent[r1]; parent[r1]=r2; }}int Kruskal(){ int s=0; for(int i=0;i<m;i++){ int u=edge[i].u,v=edge[i].v,w=edge[i].w; if(Find(u)!=Find(v)){ s+=w; Union(u,v); } } return s; }int main(){ while(~scanf("%d %d",&n,&m)&&m+n){ memset(parent,-1,sizeof(parent)); ans=0; for(int i=0;i<m;i++){ scanf("%d %d %d",&edge[i].u,&edge[i].v,&edge[i].w); ans+=edge[i].w; } sort(edge,edge+m,cmp); sum=Kruskal(); printf("%d\n",ans-sum); } return 0;}
^
0_0_20612567_32730.cpp: In function 'int cmp(const int&, const int&)':
0_0_20612567_32730.cpp:5:163: error: request for member 'w' in 'p', which is of non-class type 'const int'
using namespace std;#define maxn 200010struct node{ int u,v,w;}edge[maxn];int parent[maxn];int n,m,ans,sum;int cmp(const node &p,const node &q){ return p.w<q.w;}int Find(int x){ int i; for(i=x;parent[i]>=0;i=parent[i]) ; while(i!=x){ int tmp=parent[x]; parent[x]=i; x=tmp; } return i;}void Union(int x,int y){ int r1=Find(x),r2=Find(y); if(r1==r2) return; if(parent[r1]<parent[r2]){ parent[r1]+=parent[r2]; parent[r2]=r1; }else { parent[r2]+=parent[r1]; parent[r1]=r2; }}int Kruskal(){ int s=0; for(int i=0;i<m;i++){ int u=edge[i].u,v=edge[i].v,w=edge[i].w; if(Find(u)!=Find(v)){ s+=w; Union(u,v); } } return s; }int main(){ while(~scanf("%d %d",&n,&m)&&m+n){ memset(parent,-1,sizeof(parent)); ans=0; for(int i=0;i<m;i++){ scanf("%d %d %d",&edge[i].u,&edge[i].v,&edge[i].w); ans+=edge[i].w; } sort(edge,edge+m,cmp); sum=Kruskal(); printf("%d\n",ans-sum); } return 0;}
^
0_0_20612567_32730.cpp:5:167: error: request for member 'w' in 'q', which is of non-class type 'const int'
using namespace std;#define maxn 200010struct node{ int u,v,w;}edge[maxn];int parent[maxn];int n,m,ans,sum;int cmp(const node &p,const node &q){ return p.w<q.w;}int Find(int x){ int i; for(i=x;parent[i]>=0;i=parent[i]) ; while(i!=x){ int tmp=parent[x]; parent[x]=i; x=tmp; } return i;}void Union(int x,int y){ int r1=Find(x),r2=Find(y); if(r1==r2) return; if(parent[r1]<parent[r2]){ parent[r1]+=parent[r2]; parent[r2]=r1; }else { parent[r2]+=parent[r1]; parent[r1]=r2; }}int Kruskal(){ int s=0; for(int i=0;i<m;i++){ int u=edge[i].u,v=edge[i].v,w=edge[i].w; if(Find(u)!=Find(v)){ s+=w; Union(u,v); } } return s; }int main(){ while(~scanf("%d %d",&n,&m)&&m+n){ memset(parent,-1,sizeof(parent)); ans=0; for(int i=0;i<m;i++){ scanf("%d %d %d",&edge[i].u,&edge[i].v,&edge[i].w); ans+=edge[i].w; } sort(edge,edge+m,cmp); sum=Kruskal(); printf("%d\n",ans-sum); } return 0;}
^
0_0_20612567_32730.cpp: In function 'int Find(int)':
0_0_20612567_32730.cpp:5:202: error: 'parent' was not declared in this scope
using namespace std;#define maxn 200010struct node{ int u,v,w;}edge[maxn];int parent[maxn];int n,m,ans,sum;int cmp(const node &p,const node &q){ return p.w<q.w;}int Find(int x){ int i; for(i=x;parent[i]>=0;i=parent[i]) ; while(i!=x){ int tmp=parent[x]; parent[x]=i; x=tmp; } return i;}void Union(int x,int y){ int r1=Find(x),r2=Find(y); if(r1==r2) return; if(parent[r1]<parent[r2]){ parent[r1]+=parent[r2]; parent[r2]=r1; }else { parent[r2]+=parent[r1]; parent[r1]=r2; }}int Kruskal(){ int s=0; for(int i=0;i<m;i++){ int u=edge[i].u,v=edge[i].v,w=edge[i].w; if(Find(u)!=Find(v)){ s+=w; Union(u,v); } } return s; }int main(){ while(~scanf("%d %d",&n,&m)&&m+n){ memset(parent,-1,sizeof(parent)); ans=0;
|