当你写下这样的懒人代码,可得30pts。
#include <bits/stdc++.h>
using namespace std;
struct stu
{
int pai;
long long shu;
};
stu a[250000];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int n,q,c;
cin>>n>>q>>c;
for(int i=1; i<=n; i++) cin>>a[i].shu;
for(int i=1; i<=n; i++) cin>>a[i].pai;
for(int i=1; i<=q; i++)
{
short op;
int l,r,x,y,v;
cin>>op>>l>>r;
if(op==1)
{
cin>>x>>y;
for(int j=l; j<=r; j++)
{
if(a[j].pai==x) a[j].pai=y;
}
}
else if(op==2)
{
cin>>x>>v;
for(int j=l; j<=r; j++)
{
if(a[j].pai==x) a[j].shu+=v;
}
}
else
{
long long s=0;
for(int j=l; j<=r; j++) s+=a[j].shu;
cout<<s<<'\n';
}
}
return 0;
}