下面是csp-s T3暴力代码,没吸氧前70pts,剩下的点全TLE,吸氧后全RE
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
using namespace std;
const int N=1e6;
const int mod=998244353;
vector<int> query[N];
int n,m,T,Q;
int w[N],id[N];
struct SegTree{
int l,r;
long long sum,add,mul;
}tr[N<<2];
inline void read(int &x){
x=0;int f=1;char c=getchar();
while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
while(isdigit(c)){x=(x<<1)+(x<<3)+(c^48);c=getchar();}
x*=f;
}
long long eval(SegTree &t,int add,int mul){
t.sum=((long long)t.sum*mul+(long long)(t.r-t.l+1)*add)%mod;
t.mul=((long long)t.mul*mul)%mod;
t.add=((long long)t.add*mul+add)%mod;
}
void pushup(int u){
tr[u].sum=(tr[u<<1].sum+tr[u<<1|1].sum)%mod;
}
void pushdown(int u){
eval(tr[u<<1],tr[u].add,tr[u].mul);
eval(tr[u<<1|1],tr[u].add,tr[u].mul);
tr[u].add=0,tr[u].mul=1;
}
void build(int u,int l,int r){
if(l==r) tr[u]={l,r,w[r],0,1};
else{
tr[u]={l,r,0,0,1};
int mid=(l+r)>>1;
build(u<<1,l,mid),build(u<<1|1,mid+1,r);
pushup(u);
}
}
void modify(int u,int l,int r,int add,int mul){
if(tr[u].l>=l&&tr[u].r<=r) eval(tr[u],add,mul);
else{
pushdown(u);
int mid=(tr[u].l+tr[u].r)>>1;
if(l<=mid) modify(u<<1,l,r,add,mul);
if(r>mid) modify(u<<1|1,l,r,add,mul);
pushup(u);
}
}
void call_1(int _id){
int a=query[_id][0],b=query[_id][1];
modify(1,a,a,b,1);
}
void call_2(int _id){
int a=query[_id][0];
modify(1,1,n,0,a);
}
void call_3(int _id){
for(int i=0;i<query[_id].size();i++){
int func=query[_id][i];
if(id[func]==1){
call_1(func);
}
else if(id[func]==2){
call_2(func);
}
else{
call_3(func);
}
}
}
void work(){
int f;
while(Q--){
read(f);
if(id[f]==1){
call_1(f);
}
else if(id[f]==2){
call_2(f);
}
else{
call_3(f);
}
}
}
long long ask(int u,int l,int r){
if(tr[u].l>=l&&tr[u].r<=r) return tr[u].sum;
pushdown(u);
int mid=(tr[u].l+tr[u].r)>>1;
long long res=0;
if(l<=mid) res=ask(u<<1,l,r);
if(r>mid) res=(res+ask(u<<1|1,l,r))%mod;
return res;
}
int main(){
read(n);
for(int i=1;i<=n;++i) read(w[i]);
build(1,1,n);
read(m);
for(int i=1;i<=m;i++){
read(T);
if(T==1){
int a,b;
read(a),read(b);
query[i].push_back(a);
query[i].push_back(b);
id[i]=1;
}
else if(T==2){
int a;
read(a);
query[i].push_back(a);
id[i]=2;
}
else{
int C;
read(C);
id[i]=3;
while(C--){
int g;
read(g);
query[i].push_back(g);
}
}
}
read(Q);
work();
for(int i=1;i<=n;i++){
printf("%lld ",ask(1,i,i));
}
return 0;
}