Submission #95203

# Submission time Handle Problem Language Result Execution time Memory
95203 2019-01-28T14:35:53 Z easrui Pyramid Base (IOI08_pyramid_base) C++14
Compilation error
0 ms 0 KB
void upt(int l, int r, int c, int s, int e, int pos)
{
    if(e<l || s>r) return;
    if(L[pos] && s!=e){
        ST[2*pos] += L[pos];
        ST[2*pos+1] += L[pos];
        L[2*pos] += L[pos];
        L[2*pos+1] += L[pos];
        L[pos] = 0;
    }
    if(l<=s && e<=r){
        ST[pos] += c;
        L[pos] += c;
        return;
    }
    int m = (s+e)/2;
    upt(l,r,c,s,m,2*pos);
    upt(l,r,c,m+1,e,2*pos+1);
}

int sum(int l, int r, int s, int e, int pos)
{
    if(e<l || s>r) return 0;
    if(L[pos] && s!=e){
        ST[2*pos] += L[pos];
        ST[2*pos+1] += L[pos];
        L[2*pos] += L[pos];
        L[2*pos+1] += L[pos];
        L[pos] = 0;
    }
    if(l<=s && e<=r){
        if(ST[pos]) return e-s+1;
    }
    if(s==e) return ST[pos];
    int m = (s+e)/2;
    return sum(l,r,s,m,2*pos) + sum(l,r,m+1,e,2*pos+1);
}

Compilation message

pyramid_base.cpp: In function 'void upt(int, int, int, int, int, int)':
pyramid_base.cpp:4:8: error: 'L' was not declared in this scope
     if(L[pos] && s!=e){
        ^
pyramid_base.cpp:5:9: error: 'ST' was not declared in this scope
         ST[2*pos] += L[pos];
         ^~
pyramid_base.cpp:12:9: error: 'ST' was not declared in this scope
         ST[pos] += c;
         ^~
pyramid_base.cpp:13:9: error: 'L' was not declared in this scope
         L[pos] += c;
         ^
pyramid_base.cpp: In function 'int sum(int, int, int, int, int)':
pyramid_base.cpp:24:8: error: 'L' was not declared in this scope
     if(L[pos] && s!=e){
        ^
pyramid_base.cpp:25:9: error: 'ST' was not declared in this scope
         ST[2*pos] += L[pos];
         ^~
pyramid_base.cpp:32:12: error: 'ST' was not declared in this scope
         if(ST[pos]) return e-s+1;
            ^~
pyramid_base.cpp:34:21: error: 'ST' was not declared in this scope
     if(s==e) return ST[pos];
                     ^~