Cod sursa(job #1827959)

Utilizator triscacezarTrisca Vicol Cezar triscacezar Data 12 decembrie 2016 16:31:22
Problema Hotel Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.69 kb
#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];
}