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

这里改成bp<n-1就过了。。。水题wa永远潜力无限!!

Posted by 515363446 at 2011-12-11 20:06:18 on Problem 1089 and last updated at 2011-12-11 20:06:46
In Reply To:一直wa,真心跪求更多测试数据!!! Posted by:515363446 at 2011-12-11 19:37:33
> 其他帖子里边的数据都过了
> 
> #define m 50001
> #include<stdio.h>
> #include<stdlib.h>
> main()
> {
> 	int comp(const void *a,const void *b);
> 	int n,a[m],b[m],i=0,j,t,ap,bp;
> 	scanf("%d",&n);
> 	while(i<n)
> 		scanf("%d %d",&a[i],&b[i++]);
> 	qsort(a,n,sizeof(int),comp);
> 	qsort(b,n,sizeof(int),comp);
> //	for(i=0;i<n;i++)
> //		printf("%d",b[i]);
> 	ap=0,bp=0;
> 	while(bp<n)            这里改成bp<n-1就过了。。。水题wa永远潜力无限!!
> 	{
> 		if(b[bp]<a[bp+1])
> 		{
> 			b[ap]=b[bp];
> 			ap++;
> 			bp++;
> 			a[ap]=a[bp];
> 		}
> 		else
> 			bp++;
> 	}
> 	b[ap]=b[n-1];
> 	for(i=0;i<=ap;i++)
> 	{
> 		printf("%d %d\n",a[i],b[i]);
> 	}
> }
> int comp(const void *a,const void *b)
> {
> 	return(*(int*)a-*(int*)b);
> }

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