提交时间:2021-06-20 19:35:16
运行 ID: 20901
#include<bits/stdc++.h> using namespace std; int n,k,ans[20],s[20],sum=1; int main(){ cin>>n>>k; memset(ans,0,sizeof(ans)); for(int i=1;i<=n;i++){ for(int j=1;j<=k;j++)cin>>s[j]; for(int j=1;j<=k;j++){ if((ans[j]==1&&s[j]==2)||(ans[j]==2&&s[j]==1)){ cout<<"-1"; return 0; } else if(ans[j]==0)ans[j]=s[j]; } } for(int i=1;i<=k;i++){ if(ans[i]==0)sum*=2; } cout<<sum; }