Cod sursa(job #661795)
| Utilizator | Data | 15 ianuarie 2012 11:45:50 | |
|---|---|---|---|
| Problema | Arbori de intervale | Scor | 40 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.46 kb |
#include<fstream>
using namespace std;
int main()
{
int v[100000],m,n,B,c,A,max,op,d;
ifstream in("arbint.in");
ofstream out("arbint.out");
in>>n;
in>>m;
for(c=1; c<=n; c++)
in>>v[c];
for(c=0; c<m; c++)
{
in>>op;
in>>A;
in>>B;
if(op==0)
{
max=-1;
for(d=A; d<=B; d++)
if(v[d]>max)
max=v[d];
out<<max<<"\n";
}
if(op==1)
v[A]=B;
}
in.close();
out.close();
return 0;
}
