线性基裸题。
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
ll a[110];
char s[60];
bool add(ll x)
{
for(ll i = 60; i >= 0; i--)
{
if(x >>i & 1)
{
if(!a[i])
{
a[i] = x;
}
x = x ^a[i];
}
}
return x > 0;
}
int main()
{
int n, m;
scanf("%d%d", &n, &m);
ll ans = 0;
for(int i = 0; i < m; i++)
{
scanf("%s", s);
ll tot = 0;
int len = strlen(s);
for(int j = 0; j < len; j++)
{
if(s[j] == 'O')
tot = tot*2 + 1;
else
tot *= 2;
}
add(tot);
}
for(int i = 0; i <= 60; i++)
if(a[i])
ans++;
printf("%lld\n", ((ll)1<<ans) % 2008);
return 0;
}