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 tide713 at 2004-12-04 22:16:56 on Problem 2104
#include<stdio.h>
#include<stdlib.h>
long a[100000];

int cmp(const void *p,const void *q)
{    
	return *(int *)p-*(int *)q;
} 
int main()
{  long b,c,x,y,z,i,j,k,n,m,f,g,g1;
   long d[100000];
    scanf("%d%d",&n,&m);
    for(i=0;i<n;i++)
    {   scanf("%d",&a[i]);
    }
    for(i=0;i<m;i++)
    {    scanf("%d%d%d",&x,&y,&z);
          b=0;
         for(j=x-1;j<y;j++)
          {   d[b++]=a[j]; 
          }
          g1=0;
		  qsort(d,y-x+1,sizeof(int),cmp);
           printf("%d\n",d[z-1]);
     }
return(1);
}
下面是我提交时候的信息:
Problem Id:2104  User Id:tide713 
Memory:452K  Time:3479MS
Language:G++  Result:Time Limit Exceed

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