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

给的数据过了,但是还是wa,求高人修改

Posted by yjdhr007 at 2012-08-30 23:15:54 on Problem 1125
#include<iostream>
using namespace std;
int main(void)
{
	int arr[201][201];
	int n,m,i,j,k,min,mini;
	int judge[101];
	while(cin>>n&&n)
	{
		//memset(arr,1,sizeof(arr)); 
		for(i=1;i<=n;i++)
			for(j=1;j<=n;j++)
				arr[i][j]=20;
			memset(judge,0,sizeof(judge)); 
			for(i=1;i<=n;i++)
			{
				cin>>m;
				arr[i][i]=0;
				for(j=0;j<m;j++)
				{
					cin>>k;
					cin>>arr[i][k];
				}
				
			}
			for(k=1;k<=n;k++)
				for(i=1;i<=n;i++)
					for(j=1;j<=n;j++)
						if(arr[i][j]>arr[i][k]+arr[k][j])
						{
							arr[i][j]=arr[i][k]+arr[k][j];
						}
						for(i=1;i<=n;i++)
							for(j=1;j<=n;j++)
								if(judge[i]<arr[i][j])
									judge[i]=arr[i][j];
								min=20;
								for(i=1;i<=n;i++)
									if(judge[i]<min)
									{
										min=judge[i];
										mini=i;
									}
									if(min>10)
										cout<<"disjoint"<<endl; 
									else
										cout<<mini<<' '<<min<<endl;
									
									
								cout<<endl;
					}
									
	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