Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:Beg some propositions of my wrong codeIn Reply To:Beg some propositions of my wrong code Posted by:zerk at 2006-05-30 23:01:10 > int find(int x) > { > if(f[x]!=x) > f[x]=find(f[x]); > return f[x]; > } > > void process() > { > int i,j,k,a,b; > for( i=0; i<=l+10; i++ ) f[i] = i; > > for( k=1; k<=m; k++ ) > { > i = arr[k].i; j = arr[k].j; > a = find(i-1); b = find(j); ~~~~~~~~~i should be decremented before being mapped to subscripts > if( a==b ) > { > if( d[i-1]-d[j]!=arr[k].v ) printf("Bug Detected %d\n",d[i-1]-d[j]); > else printf("Accept\n"); > } > else{ > f[b] = a; d[b] = d[i-1]-d[j]-arr[k].v; > printf("Accept\n"); > } > } > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator