彩灯

线性基基础题( 1 l l < < i 1ll<<i 1ll<<i一定要写 l l ll ll !)
单纯地想在线性基专题中水一篇博客,hhh

题意:没啥讲的
思路:太简单了(求线性空间的秩)

题面描述

#include "bits/stdc++.h"
#define hhh printf("hhh\n")
#define see(x) (cerr<<(#x)<<'='<<(x)<<endl)
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
inline ll read() {ll x=0;char c=getchar();while(c<'0'||c>'9')c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return x;}

const int maxn = 1e5+10;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-7;

char s[maxn];
ll p[63], cnt;

void insert(ll a) {
    for(int i=62; i>=0; --i) if(a>>i&1) {
        if(!p[i]) { p[i]=a; break; }
        a^=p[i];
    }
}

int main() {
    //ios::sync_with_stdio(false); cin.tie(0);
    int n=read(), m=read();
    for(int i=1; i<=m; ++i) {
        scanf("%s", s); ll cur=0;
        for(int i=0; i<n; ++i) if(s[i]=='O') cur|=1ll<<i;
        insert(cur);
    }
    for(int i=0; i<=62; ++i) if(p[i]) cnt++;
    printf("%lld\n", (1ll<<cnt)%2008);
}