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:Memory Limit Exceed?????????????????

Posted by Eli_love at 2009-06-27 21:52:23 on Problem 2833
In Reply To:Re:Memory Limit Exceed????????????????? Posted by:Eli_love at 2009-06-27 21:51:38
#include<iostream>
using namespace std;
__int64 a[5000003];
void qsort(int l,int r)
{
	int i,j,x;
	i=l;j=r;x=a[(i+j)>>1];
	while(i<=j)
	{
		while(a[i]<x) i++;
		while(a[j]>x) j--;
		if(i<=j)
		{
			int t;
			t=a[i];a[i]=a[j];a[j]=t;
			i++;j--;
		}
	}
	if(i<r) qsort(i,r);
	if(j>l) qsort(l,j);
}
int main()
{
	int n1,n2,n,i;
	double sum;
	while(scanf("%d%d%d",&n1,&n2,&n))
	{
		if(n1==0 && n2==0 && n==0) break;
		sum=0.0;
	    for(i=1;i<=n;i++) scanf("%I64d",&a[i]);
	    qsort(1,n);
	    for(i=n2+1;i<=n-n1;i++) sum+=a[i];
	    sum=sum/(n-n1-n2);
	    printf("%.6lf\n",sum);
	}
	return 0;
}
 一样MLE!!!!!!!!

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