题解 | #彩虹涂鸦#
彩虹涂鸦
https://www.nowcoder.com/practice/507cf29e541545c18968fd0436ad8b23
// 模拟!
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,q,l,r,k,pos;
cin >> n >> q;
vector<int> a(n+1,0),c(n+1,0),col;
int opt,mx;
map<int,int> cnt;
while(q--){
cin >> opt;
if(opt == 1){
cin >> l >> r >> k;
col.resize(k);
for(int i = 0; i < k; ++i) cin >> col[i];
pos = 0;
for(int i = l; i <= r; ++i){
int d = col[pos];
pos = (pos+1)%k;
if(a[i] != d) ++c[i];
a[i] = d;
}
}else if(opt == 2){
cin >> pos;
cout << c[pos] << " " << a[pos] << endl;
}else {
cin >> l >> r;
cnt.clear();
for(int i = l; i <= r; ++i) cnt[a[i]] ++;
mx = 0;
for(auto x : cnt) mx = max(mx,x.second);
cout << mx << endl;
}
}
return 0;
}