| ||||||||||
| 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 <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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator