Pagini recente » Cod sursa (job #990335) | Cod sursa (job #890315) | Cod sursa (job #944522) | Cod sursa (job #232594) | Cod sursa (job #1827959)
#include <fstream>
using namespace std;
ifstream f("hotel.in");
ofstream g("hotel.out");
void upd(int,int,int);
int n,p;
int main()
{
f>>n>>p;
//L si D
return 0;
}
void upd(int nod,int st,int dr)
{
if(L<=st&&dr<=R)
{
tip[nod]=val;//???
if(val==1)
stg[nod]=dre[nod]=best[nod]=0;
else
stg[nod]=dre[nod]=best[nod]=dr-st+1;
return ;
}
mi=(st+dr)/2;
upd(2*nod,st,mi);
upd(2*nod+1,mi,dr);
int FS=2*nod;
int FD=2*nod+1;
stg[nod]=stg[FS];
if(stg[FS]==best[FS])
stg[nod]+=stg[FD];
dre[nod]=dre[FD];
if(dre[FD]==best[FD])
dre[nod]+=dre[FS];
}