Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
这里改成bp<n-1就过了。。。水题wa永远潜力无限!!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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator