运行时不报错,调试时报错信息是 program received signal SIGTRAP Trace/breakpoint trap
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define mp make_pair
#define fi first
#define se second
inline int read(){
int x=0,flag=1;char ch=getchar();
while(ch<'0' || ch>'9'){flag=(ch=='-')?-1:1;ch=getchar();}
while(ch>='0' && ch<='9'){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
return x*flag;
}
//const int N=40;
const int M=1e5+20;
string a[M];int n,m,q;
struct Tree{int l,r,val;string st;}t[M<<2],ZERO;
Tree operator+(const Tree &A,const Tree &B){
Tree res;
res.l=A.l,res.r=B.r,res.val=1;
for(int i=1;i<=n;++i){
if(A.st[i]==B.st[i])res.st[i]=A.st[i],res.val*=(A.st[i]=='?'?2:1);
else if(A.st[i]=='?'||B.st[i]=='?')res.st[i]=(A.st[i]=='?'?B.st[i]:A.st[i]);
else res.st[i]='!',res.val=0;
// cerr<<"+"<<res.st[i]<<' ';
}
// cerr<<"-";for(int i=1;i<=n;++i)cerr<<res.st[i];cerr<<'\n';
return res;
}
void build(int p,int l,int r){
t[p].l=l,t[p].r=r;
if(l==r){t[p].val=1,t[p].st=a[l];for(int i=1;i<=n;++i)t[p].val*=(a[l][i]=='?'?2:1);return;}
int mid=(l+r)>>1;
build(p<<1,l,mid);
build(p<<1|1,mid+1,r);
t[p]=t[p<<1]+t[p<<1|1];
// cerr<<p<<' '<<t[p].l<<' '<<t[p].r<<' '<<t[p].st<<'\n';
}
Tree query(int p,int l,int r){
if(l<=t[p].l&&t[p].r<=r)return t[p];
int mid=(t[p].l+t[p].r)>>1;Tree res=ZERO;
if(l<=mid)res=res+query(p<<1,l,r);
if(mid<r)res=res+query(p<<1|1,l,r);
return res;
}
void change(int p,int pos,string st){
if(t[p].l==t[p].r){t[p].val=1,t[p].st=st;for(int i=1;i<=n;++i)t[p].val*=(st[i]=='?'?2:1);return;}
int mid=(t[p].l+t[p].r)>>1;
if(pos<=mid)change(p<<1,pos,st);
if(mid<pos)change(p<<1|1,pos,st);
t[p]=t[p<<1]+t[p<<1|1];
}
signed main(){
n=read(),m=read(),q=read();
ZERO={0,0,1," "};
for(int i=1;i<=n;++i)ZERO.st[i]='?';
for(int i=1;i<=n;++i)cin>>a[i],a[i]="!"+a[i];
build(1,1,m);
// cerr<<"fin";for(int i=1;i<=n;++i)cerr<<t[2].st[i];cerr<<'\n';
while(q--){
int op=read();
if(op){int pos=read();string st;cin>>st;st="!"+st;change(1,pos,st);}
else{
int l=read(),r=read();
cout<<query(1,l,r).val<<'\n';
}
}
return 0;
}