#include #include #include using namespace atcoder; using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define Inf 1000000001 struct Data{ long long cnt[6],sum[6]; Data(){ rep(i,6){ cnt[i] = 0; sum[i] = 0; } } }; struct D2{ int color=-1; long long num = 0; bool f = false; }; Data op(Data a,Data b){ rep(i,6){ a.cnt[i] += b.cnt[i]; a.sum[i] += b.sum[i]; } return a; } Data e(){ return Data(); } Data mapping(D2 a,Data b){ if(a.color==-1)return b; if(a.f){ rep(i,6){ if(i==a.color)continue; b.cnt[a.color] += b.cnt[i]; b.sum[i] = 0; b.cnt[i] = 0; } b.sum[a.color] = b.cnt[a.color] * a.num; } else{ //cout<>n>>q; vector x(q),l(q),r(q); vector t; t.push_back(0); t.push_back(n); rep(i,q){ cin>>x[i]>>l[i]>>r[i]; r[i]++; t.push_back(l[i]); t.push_back(r[i]); } sort(t.begin(),t.end()); t.erase(unique(t.begin(),t.end()),t.end()); rep(i,q){ l[i] = distance(t.begin(),lower_bound(t.begin(),t.end(),l[i])); r[i] = distance(t.begin(),lower_bound(t.begin(),t.end(),r[i])); } lazy_segtree seg; { vector temp(t.size()-1); rep(i,temp.size()){ Data x; x.cnt[0] = t[i+1] - t[i]; temp[i] = x; } seg = lazy_segtree(temp); } vector<__int128> ans(6,0); rep(i,q){ if(x[i]!=0){ D2 tt; tt.color = x[i]; tt.num = 1; seg.apply(l[i],r[i],tt); } else{ auto ret = seg.prod(l[i],r[i]); long long m = -1; for(int j=1;j<6;j++){ m = max(m,ret.sum[j]); } int c = 0; for(int j=1;j<6;j++){ if(m==ret.sum[j])c++; } if(c==1){ for(int j=1;j<6;j++){ if(m==ret.sum[j]){ ans[j] += m; } } } } } long long MM = 1000000000000000009; auto ret = seg.all_prod(); rep(j,6)ans[j] += ret.sum[j]; for(int i=1;i<6;i++){ if(i!=1)cout<<' '; cout<<((long long)(ans[i]%MM)); } cout<