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 frkstyc at 2005-05-15 22:09:33 on Problem 2104
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:
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