hiho week 20 register

Ended

Participants:214

Verdict:Accepted
Score:100 / 100
Submitted:2014-11-17 19:04:35

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MaxA=1e5+7;
struct SegmentTree
{
    int c[MaxA<<2];
    int delay[MaxA<<2];
    
    #define lson l,m,rt<<1
    #define rson m+1,r,rt<<1|1
    
    void pushUp(int rt)
    {
        c[rt]=c[rt<<1]+c[rt<<1|1];
    }
    
    void pushDown(int rt,int len)
    {
        if(delay[rt])
        {
            delay[rt<<1]=delay[rt<<1|1]=delay[rt];
            c[rt<<1]=delay[rt]*(len-(len>>1));
            c[rt<<1|1]=delay[rt]*(len>>1);
            delay[rt]=0;
        }
    }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX