上帝造题五分钟

 1 #include<iostream>
 2 #include<algorithm>
 3 #include<cstdio>
 4 using namespace std;
 5 int main()
 6 {
 7     int str[2000],tmp[2000];
 8     int n,q,l,r,j;
 9     while(~scanf("%d%d",&n,&q))
10     {
11         for(int i=0;i<n;i++)
12             scanf("%d",&str[i]);
13         while(q--)
14         {
15             j=0;
16             scanf("%d%d",&l,&r);
17             for(int i=l;i<=r;i++)
18                 tmp[j++]=str[i];
19             int len=r-l+1;
20             sort(tmp,tmp+len);
21             printf("%d\n",tmp[0]);
22         }
23     }
24 }
View Code

 

posted on 2016-01-26 23:35  青春的梦想付诸行动  阅读(159)  评论(0)    收藏  举报

导航