Solution:
- 裸的线性基,往里面添加数,记录添加个数\(sum\),快速幂输出\(2^{sum}\)即可
Code:
//It is coded by Ning_Mew on 5.30
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int maxn=70,MOD=2008;
int n,m;
LL s[maxn],x[maxn],ans=0;
LL read(){
char ch=getchar();LL re=0;
while(ch!='O'&&ch!='X')ch=getchar();
while(ch=='O'||ch=='X'){
if(ch=='O')re=((re<<1)^1);
if(ch=='X')re=(re<<1);
ch=getchar();
}return re;
}
bool push(LL ss){
for(int i=63;i>=0;i--){
if((ss>>i)&1){
if(!x[i]){x[i]=ss;return true;}
else ss=(ss^x[i]);
}
}return false;
}
LL q_pow(LL x,LL t){
LL re=1;
while(t){
if(t%2){re=(re*x%MOD);}
x=x*x%MOD;
t=t/2;
}return re;
}
int main(){
scanf("%d%d",&n,&m);
for(int i=1;i<=m;i++){
s[i]=read();//cout<<i<<' '<<s[i]<<endl;
}
for(int i=1;i<=m;i++){
if(push(s[i]))ans++;
}
printf("%lld\n",q_pow(2,ans));
return 0;
}
博主蒟蒻,随意转载。但必须附上原文链接:http://www.cnblogs.com/Ning-Mew/,否则你会终生找不到妹子!!!
原文地址:https://www.cnblogs.com/Ning-Mew/p/9113552.html
时间: 2024-11-09 03:49:10