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

好水的一道题~~~~注意,输入的数据量大,不宜用cin,用scanf暴减1000+MS,贴个代码参考。

Posted by 0943041192 at 2011-02-15 14:59:11 on Problem 1949
#include <stdio.h>
#define REP(i,j,k) for(i=j;i<k;i++)

int main()
{
	int i,j,k,max,n,m,t=0;
	int chores[10005];
	scanf("%d",&n);
	REP(i,0,n)
	{
		scanf("%d",&chores[i]);
		scanf("%d",&m);
		max = 0;
		REP(j,0,m)
		{
			scanf("%d",&k);
			max =(chores[k-1]>max)?chores[k-1]:max;
		}
		chores[i] += max;
		t = (chores[i]>t)?chores[i]:t;
	}
	printf("%d\n",t);
	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