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

边的起始值设置为0,导致调了n久,faint

Posted by gada at 2009-10-06 16:43:22 on Problem 1201
int k = 1;
	for(int i = 0; i < n; ++i)
	{
		scanf("%d %d %d", &a, &b, &c);
		G[k].w = c; G[k].end = b+1; G[k].next = first[a]; first[a] = k++;
		if(outset > a) outset = a;
		if(destination < b+1) destination = b+1;
	}
	for(int i = outset+1; i <= destination; ++i)
	{
		G[k].w = 0; G[k].end = i; G[k].next = first[i-1]; first[i-1] = k++;
		G[k].w = -1; G[k].end = i-1; G[k].next = first[i]; first[i] = k++;
	}
k值一开始设置为0,和first数组的值一样,导致覆盖掉了一些边,哎。

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