//yuki945.cpp //Sun Jan 12 12:10:55 2020 #include #include #include #include #include #include #include #include #include #define INTINF 2147483647 #define LLINF 9223372036854775807 using namespace std; using ll=long long; typedef pair P; int nodenum,seg[4*2*100000],lazy[4*2*100000]; void init(int n){ nodenum = 1; while (nodenum1){ lazy[k*2+1] = lazy[k]; lazy[k*2+2] = lazy[k]; } lazy[k] = 0; } } void update(int a, int b, int x, int k, int l, int r){ eval(k,l,r); if (b<=l || r<=a){ return; } if (a<=l && r<=b){ lazy[k] = x; eval(k,l,r); }else { update(a,b,x,2*k+1,l,(l+r)/2); update(a,b,x,2*k+2,(l+r)/2,r); } } void evalall(int a, int b, int k, int l, int r){ eval(k,l,r); if (r-l>1){ evalall(a,b,k*2+1,l,(l+r)/2); evalall(a,b,k*2+2,(l+r)/2,r); } } int main(){ int n,m; cin >> n >> m; int l[m],r[m],t[m]; for (int i=0;i> l[i] >> r[i] >> temp; l[i]--;r[i]--; if (temp=='Y'){ t[i] = 1; }else if (temp=='K'){ t[i] = 2; }else { t[i] = 3; } } reverse(l,l+m); reverse(r,r+m); reverse(t,t+m); init(n); for (int i=0;i