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

求救啊,哪位高手能给指点一下哪里错了啊?????

Posted by yanzhu at 2009-07-30 20:26:53 on Problem 1182
#include<iostream>
using namespace std;
int main()
{
	int n,k,a[50000]={0},d[10000],x[10000],y[10000],sum=0,cur=0,z[10000],b;
  cin>>n>>k;
  for(int i=0;i<k;i++)
  {
	  b=0;
	  cin>>d[i]>>x[i]>>y[i];
      if(x[i]>n||y[i]>n)
		  a[i]=1;
	  else
	  {
	     if(d[i]==2&&x[i]==y[i])
			 a[i]=1;
		 else
		 {
			 for(int j=0;j<i;j++)
			 {
			   if(a[j]!=1)//互相吃
			   {
				   if(d[i]==2)
				   {
				     if(d[j]==2)
					 {
						 if((x[i]==y[j]&&x[j]==y[i]))
							 b=1;
					 }
					 else
					 {int t1=1,t2=1;
					     for(int q=0;q<cur;q++)
						   {
						     if(z[q]==x[i])
								 t1=0;
							  if(z[q]==y[i])
								 t2=0;
						   }
						   if(t1==0&&t2==0)
						   {
							   //a[i]=0;
							   z[cur]=x[i];
							   z[cur]=y[i];
						   }
						   else
							   b=1;
					 }
				   }
				   else// 表同类
				   {
				     if(d[j]==2)
					 {
						 if(((x[i]==x[j]&&y[i]==y[j])||(x[i]==y[j]&&x[j]==y[i])))
							 b=1;
					 }
					 



				   }
			   }
			     
			 }
			 if(b==1)
				 a[i]=1;
		 }
	  }
	  cur++;
	  sum+=a[i];

  }
  cout<<sum<<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