最后一个点 WA了 qwq...求助

P3857 [TJOI2008] 彩灯

leprechaun_kdl @ 2019-08-25 23:57:27

感觉自己这水平要凉凉

#include <iostream>
#include <cstring>
using namespace std;
#define ri register int
#define ll long long

int n,m;
string x;
ll xs,tot;
ll G[80];
inline void insert(ll x) {
    for(ri i = 62; i >= 0; --i) {
        if(!(x >> (ll)i)) continue;
        if(!G[i]) {
            G[i] = x;
            break;
        }
        x ^= G[i];
    }
}

signed main() {
    ios::sync_with_stdio(0),cin.tie(0);
    cin >> n >> m;
    for(ri i = 1; i <= m; ++i) {
        cin >> x;
        for(ri j = x.length() - 1; j >= 0; --j) {
            if(x[j] == 'O') xs <<= 1ll,xs |= 1ll;
            else xs <<= 1ll;
        }
        insert(xs);
    }
    for(ri i = 62; i >= 0; --i) {
        if(G[i]) ++tot;
    }
    cout << (1ll << tot) % 2008 << '\n';
    return 0;
}

by chengor @ 2022-08-10 15:44:19

cout << (1ll << tot) % 2008 << '\n';

这段话在取模之前已经爆longlong了,写一个for吧


|