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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
| #include <cstdio>
#include <algorithm>
#include <cctype>
using namespace std;
namespace fast_io {
//...
}using namespace fast_io;
const int MAXN = 2100000,INF = 0x3f3f3f3f;
namespace SegTree{
#define ls (o<<1)
#define rs (o<<1|1)
#define mid ((l+r)>>1)
int high[MAXN<<2],low[MAXN<<2];
// op == 1 修改向上 op == 2 修改向下
void turn(int o,int v,int op){
if(op == 1){
low[o] = max(low[o],v);
high[o] = max(high[o],v);
}
if(op == 2){
low[o] = min(low[o],v);
high[o] = min(high[o],v);
}
}
void push_down(int o){
if(high[o]!=INF){turn(ls,high[o],2),turn(rs,high[o],2),high[o]=INF;}
if(low[o]!=0){turn(ls,low[o],1),turn(rs,low[o],1),low[o]=0;}
}
void update(int o,int l,int r,int ql,int qr,int v,int op){
if(ql <= l && r <= qr)
turn(o,v,op);
else{
push_down(o);
if(ql <= mid) update(ls,l,mid,ql,qr,v,op);
if(qr >= mid+1) update(rs,mid+1,r,ql,qr,v,op);
}
}
void output(int o,int l,int r,int *num){
if(l == r) num[l] = high[o];
else{
push_down(o);
output(ls,l,mid,num);
output(rs,mid+1,r,num);
}
}
}
int n,m;
void init(){
read(n),read(m);
}
void solve(){
int op,l,r,c;
for(int i = 1;i<=m;i++){
read(op),read(l),read(r),read(c);
SegTree::update(1,1,n,l+1,r+1,c,op);
}
static int ans[MAXN];
SegTree::output(1,1,n,ans);
for(int i = 1;i<=n;i++){
print(ans[i]),print('\n');
}
}
int main(){
init();
solve();
flush();
return 0;
}
|