zbbfans @ 2024-10-24 10:21:07
#include<bits/stdc++.h>
#define mod 998244353
using namespace std;
int n;
int Q;
int m;
long long a[100010];
int T,C,x,y;
int c[100010];
int wzb[100010];
vector<int> d[100010];
vector<int> e[100010];
vector<int> b[100010];
int in[100010];
void DAG(){
queue<int> q;
for(int i=1;i<=m;i++){
if(in[i]==0){
d[i].push_back(i);
q.push(i);
}
}
while(!q.empty()){
int g=q.front();q.pop();
for(int i=0;i<e[g].size();i++){
in[e[g][i]]--;
if(in[e[g][i]]==0){
for(int j=0;j<b[e[g][i]].size();j++){
for(int k=0;k<d[b[e[g][i]][j]].size();k++){
d[e[g][i]].push_back(d[b[e[g][i]][j]][k]);
}
}
q.push(e[g][i]);
}
}
}
}
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%lld",&a[i]);
}
scanf("%d",&m);
for(int i=1;i<=m;i++){
scanf("%d",&T);
if(T==1){
scanf("%d%d",&x,&y);
b[i].push_back(i);
c[i]=x;
wzb[i]=y;
}else if(T==2){
c[i]=-1;
b[i].push_back(i);
scanf("%d",&x);
wzb[i]=x;
}else{
scanf("%d",&C);
for(int j=1;j<=C;j++){
scanf("%d",&x);
b[i].push_back(x);
e[x].push_back(i);
}
in[i]+=C;
}
}
DAG();
scanf("%d",&Q);
for(int i=1;i<=Q;i++){
scanf("%d",&x);
for(int j=0;j<d[x].size();j++){
if(c[d[x][j]]>0){
a[c[d[x][j]]]+=wzb[d[x][j]];
a[c[d[x][j]]]%=mod;
}else{
for(int o=1;o<=n;o++){
a[o]*=wzb[d[x][j]];
a[o]%=mod;
}
}
}
}
for(int i=1;i<=n;i++){
printf("%lld ",a[i]);
}
return 0;
}
by malegod @ 2024-10-24 11:25:54
你这不说哪个题别人怎么看???
by zbbfans @ 2024-10-24 11:27:22
@malegod P7077所属板块上有
by malegod @ 2024-10-24 11:34:54
@zbbfans 小丑竟是我自己
by zbbfans @ 2024-10-24 11:48:46
@malegod 所以怎么改
by malegod @ 2024-10-24 14:13:01
@zbbfans .。。。怎么删除评论