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 |
这个铁定不行的In Reply To:Re:我的程序更加简单而精炼,但是还为什么超时???? Posted by:bird at 2005-05-15 22:06:47 > #include <cstdio> > #include <algorithm> > using namespace std; > int main() > { > int n,m; > scanf("%d%d",&n,&m); > long *a=new long[n],*p=a; > while(n--)scanf("%d",p++); > while(m--) > { > int i,j,k; > scanf("%d%d%d",&i,&j,&k); > int N=j-i+1; > long *b=new long[N],*q=b; > p=a+i-1; > while(N--)*(q++)=*(p++); > sort(b,q); > printf("%d\n",*(b+k-1)); > delete []b; > } > delete []a; > return 0; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator