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 |
为什么别人的比我多都不超时,我的却超了?大牛帮我看看!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator