Cod sursa(job #2768471)

Utilizator helloworld0107Iordachi Bianca helloworld0107 Data 10 august 2021 22:31:35
Problema Range minimum query Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.34 kb
#include <bits/stdc++.h>
 
 using namespace std;
 
int main()
{
    int m, n, x, y, a[100001], t = 100000;
    cin >> n >> m;
    
    for (int i = 1; i <= n; i++)
    cin >> a[i];
    
    for (int i = 1; i <= m; i++)
    {
        cin >> x >> y;
        
    for (int j = x; j <= y; j++)
     { if( a[j] < t) t = a[j]; }
    cout << t << "\n";
    }
}