WA on #9

P3857 [TJOI2008] 彩灯

lottle1212__ @ 2024-03-21 22:12:17

#include <iostream>
#define ll long long
using namespace std;
const int maxlg = 60;
int f[64], cnt, n, m;
void insert(ll x) {
    for (int i = maxlg; ~ i; -- i)
        if (x & (1ll << i))
            if (! f[i]) { f[i] = x; ++ cnt; return ; }
            else x ^= f[i];
}
signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//  freopen(".in", "r", stdin);
//  freopen(".out", "w", stdout);
    cin >> n >> m;
    while (m --) {
        ll res = 0;
        for (int i = 1; i <= n; ++ i) {
            char ch;
            cin >> ch;
            res = (res << 1) | (ch == 'X');
        }
        insert(res);
    }
    cout << (1ll << cnt) % 2008 << '\n';
    return 0;
}

|