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 lijingwei at 2010-07-04 11:21:39 on Problem 2104
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
	int n,m,i,j,k,counter;
	vector <long> a(1),b(1);
	scanf("%d%d",&n,&m);
	a.resize(n);
	for(i=0;i<n;i++)
		scanf("%d",&a[i]);
	while(m--)
	{
		scanf("%d%d%d",&i,&j,&k);
		b.resize(j-i+1);
        for(counter=0;counter<=j-i;counter++)
			b[counter]=a[counter+i-1];
		sort(b.begin(),b.end());
		printf("%d\n",*(b.begin()+k-1));
	}
	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