Pagini recente » Cod sursa (job #1742098) | Cod sursa (job #2104585) | Cod sursa (job #1719639) | Cod sursa (job #102901) | Cod sursa (job #1653964)
/**
* @brief The `not so good` solution first.
*/
#include <iostream>
#include <algorithm>
#include <climits>
#include <fstream>
#define MAX_SIZE 100000
using namespace std;
int main()
{
ifstream fin("arbint.in");
ofstream fout("arbint.out");
int storage[MAX_SIZE];
int size_st;
int operations;
fin >> size_st;
fin >> operations;
for (int i = 0; i < size_st; i++)
{
fin >> storage[i];
}
int op_type, a, b;
while (operations--)
{
fin >> op_type >> a >> b;
if (op_type == 0)
{
int max_val = INT_MIN;
for (int i = a - 1; i < b; i++)
{
max_val = max(max_val, storage[i]);
}
fout << max_val << endl;
}
else
{
storage[a - 1] = b;
}
}
fin.close();
fout.close();
return 0;
}