Pagini recente » Cod sursa (job #1641320) | Cod sursa (job #1444816) | Cod sursa (job #2064594) | Cod sursa (job #2659483) | Cod sursa (job #169394)
Cod sursa(job #169394)
#include<cstdio>
using namespace std;
int main(){
freopen("arbint.in", "r", stdin);
freopen("arbint.out", "w", stdout);
int m, n, *v;
scanf("%d%d", &n, &m);
v = new int[n];
for(int i = 0; i < n; i++)
scanf("%d", &v[i]);
for(int i = 0, o, x, y; i < m; i++){
scanf("%d%d%d", &o, &x, &y);
if(o == 0){
int max = 0;
for(int j = x - 1; j < y; j++)
if(v[j] > max) max = v[j];
printf("%d\n", max);
}
if(o == 1)
v[x-1] = y;
}
}