Pagini recente » Cod sursa (job #1610268) | Cod sursa (job #251270) | Cod sursa (job #1477377) | Cod sursa (job #3214909) | Cod sursa (job #1698636)
#include <fstream>
#include <iostream>
#include <algorithm>
std::ifstream f("arbint.in");
std::ofstream g("arbint.out");
std::string output;
using big = long long;
int N,M;
big data[100001];
void read(){
f >> N >> M;
for(int i = 1 ; i <= N ; ++i){
f >> data[i];
}
}
void execute(){
int cmd,a,b;
big rez;
for(int i = 0 ; i < M ; ++i){
f >> cmd >> a >> b;
if(cmd == 0){
rez = *std::max_element(data + a , data + b + 1);
output.append(std::to_string(rez) + "\n");
}else{
data[a] = b;
}
}
}
int main(){
read();
execute();
g << output;
g.close();
f.close();
return 0;
}