[Offer收割]编程练习赛40 register

Ended

Participants:189

Verdict:Accepted
Score:100 / 100
Submitted:2017-12-17 14:00:01

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>
#define lson l,m,x<<1
#define rson m+1,r,x<<1|1
using namespace std;
const int n = 100005;
int t[4*n],lazy[4*n];
void PushDown(int l,int r,int x)
{
    int m=(l+r)/2;
    if(lazy[x]!=0)
    {
        t[x<<1]=lazy[x];
        t[x<<1|1]=lazy[x];
        lazy[x<<1|1]=lazy[x];
        lazy[x<<1]=lazy[x];
        lazy[x]=0;
    }
}
void SegModify(int L,int R,int val,int l,int r,int x)
{
    if(l==L&&r==R)
    {
        t[x] = val;
        lazy[x] = val;
        return;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX