Pagini recente » Cod sursa (job #304436) | Cod sursa (job #1785074) | Cod sursa (job #2989481) | Cod sursa (job #2867970) | Cod sursa (job #2754790)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
ifstream f("arbint.in");
ofstream g("arbint.out");
int n, m, maxim, x, y, op;
vector <int> clasament;
int main(){
f >> n >> m;
for (int i = 0; i < n; i++){
f >> x;
clasament.push_back(x);
}
for (int i = 0; i < m; i++){
f >>op;
if (op == 1){
f >> x >> y;
clasament[x-1] = y;
}
else{
f >> x >> y;
maxim = 0;
for (int j = x - 1; j < y; j++){
if (clasament[j] > maxim)
maxim = clasament[j];
}
g << maxim << '\n';
}
}
return 0;
}