如果你60pts

P3857 [TJOI2008] 彩灯

Idtwtei @ 2024-02-18 09:11:31

因为 N<=50 ,所以位运算时应为

1ll<<j;

而不是

1<<j

by ZackofZHOU @ 2024-09-05 13:16:48

50pts

代码:

#include<iostream>
using namespace std;
typedef long long ll;
int n,m,ans,sum;
ll a[51],b[51];
string s;
bool add(ll X)
{
    for(int i = 50;i >= 0;i--)
    {
        if(X & (1ll << i))
        {
            if(b[i])
                X ^= b[i];
            else
            {
                b[i] = X;
                return true;
            }
        }
    }
    return false;
}
int main()
{
    cin >> n >> m;
    for(int i = 1;i <= m;i++)
    {
        sum = 0;
        cin >> s;
        for(int i = 0;i < s.size();i++)
            sum += (1ll << (n - i)) * (s[i] == 'O');
        ans += add(sum);
    }
    cout << (1ll << ans) % 2008;
    return 0;
}

by Bz_QC @ 2024-09-12 10:29:16

感谢!70pts的也可能是这个问题


by Sih_qwq @ 2024-09-13 09:30:58

thanks


by ZRJ_ @ 2024-11-20 19:42:57

感谢!


|