Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Beg some propositions of my wrong code

Posted by zerk at 2006-05-30 23:01:10 on Problem 2827
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);
		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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator