Cod sursa(job #702706)
| Utilizator | Data | 2 martie 2012 08:26:40 | |
|---|---|---|---|
| Problema | Arbori de intervale | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.45 kb |
#include <fstream>
//#include <iostream>
#include <vector>
using namespace std;
const int nmax=100001;
ifstream f("d.in");
ofstream g("d.out");
int m,n,x,y,c,v[nmax],mm;
int main()
{
f>>n>>m;
for(int i=1;i<=n;i++) f>>v[i];
for(int i=1;i<=m;i++)
{
f>>c>>x>>y;
if(c==1) v[x]=y;
if(c==0)
{
mm=0;
for(int j=x;j<=y;j++)
if(mm<v[j]) mm=v[j];
g<<mm<<endl;
}
}
f.close();
g.close();
return 0;
}
