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

RE到无语。。。

Posted by abilitytao at 2010-03-29 22:13:34 on Problem 3680 and last updated at 2010-03-30 19:31:30
这是我的构图  希望有高人指点。。。
struct node2
{
	int a,b,w;
}p[401];

int a[401];
int re[1000010];

int main()
{
	int n,k;
	int t;
	int i,j;
	scanf("%d",&t);
	for(j=1;j<=t;j++)
	{
		for(i=0;i<maxn;i++)
			adj[i]=NULL;
		len=0;
		scanf("%d%d",&n,&k);
	
		int pp=0;
		for(i=1;i<=n;i++)
		{
			scanf("%d%d%d",&p[i].a,&p[i].b,&p[i].w);
			pp++;
			a[pp]=p[i].a;
			pp++;
			a[pp]=p[i].b;
		}
		sort(a+1,a+1+2*n);
		int nn=1;
		for(i=2;i<=2*n;i++)
		{
			if(a[i]!=a[nn])
				a[++nn]=a[i];
		}
		n=nn;
		//

		//初始化
		for(i=1;i<=n;i++)
			re[a[i]]=i;
		for(i=0;i<=n;i++)
			insert(i,i+1,k,0);
		for(i=1;i<=n;i++)
		{
			insert(re[p[i].a],re[p[i].b],1,-p[i].w);
		}
		printf("%d\n",-mincostflow(n+2,0,n+1));
	}
	return 0;
}
历时一天 终于过了 内流满面啊

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