Created
May 26, 2014 08:22
-
-
Save zsrinivas/11d8d78312734fc00557 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <math.h> | |
#include <assert.h> | |
#include <ctype.h> | |
int lane[100010]; | |
int min(int pint, int pont); | |
int main(int argc, char const *argv[]) | |
{ | |
int n,testc,i,j; | |
scanf("%d%d", &n,&testc); | |
for (i = 0; i < n; ++i) | |
scanf("%d", &lane[i]); | |
while(testc--) | |
{ | |
scanf("%d%d", &i,&j); | |
printf("%d\n", min(i,j)); | |
} | |
return 0; | |
} | |
int min(int pint, int pont) | |
{ | |
int i,mini=lane[pint]; | |
for (i = pint+1; i <= pont; ++i) | |
if (mini>lane[i]) | |
mini=lane[i]; | |
return mini; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment