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 zqykiki at 2006-08-09 15:31:50 on Problem 1828
In Reply To:Re:好心人看一下^^--Time limit咋办? Posted by:zqykiki at 2006-08-09 15:30:34
#include<iostream.h>
int main()
{
	long a[50000],b[50000],i,n,j,p,q;
	int c[50000]={0},t=0;
	while(1)
	{
		p=0,q=0;
		cin>>n;
		t++;
		if(n==0)
			break;
		for(i=0;i<n;i++)
			cin>>a[i]>>b[i];
		for(i=0;i<n;i++)
		if(c[i]!=t)
		{
			for(j=i+1;j<n;j++)
			{
				if((a[j]>=a[i])&&(b[j]>=b[i]))
				{
					c[i]=t;
					break;
				}
				if((a[j]<=a[i])&&(b[j]<=b[i]))
					c[j]=t;
			}	
			if(c[i]!=t)
				q++;
		}
		cout<<q<<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