提交时间:2025-10-08 15:33:32
运行 ID: 38464
#include<bits/stdc++.h> using namespace std; const int N = 16400; const int md = 998244353; int k,q,a[N]; long long dp[N],b[N]; int main(){ cin>>k>>q; a[k]=1ll; for(int i=1;i<=q;i++){ int op,x; cin>>op>>x; if(op==1){ for(int j=1;j<=16383;j++){ b[j^x]=a[j]; } for(int j=1;j<=16383;j++){ int tmp=j^x; if(tmp>16383) continue; dp[j^x]=(dp[j^x]%md+a[j]%md)%md; } for(int j=1;j<=16383;j++){ a[j]=(a[j]%md+b[j]%md)%md; } } else{ cout<<(dp[x]%md+a[x]%md)%md<<endl; } } return 0; }