QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#478054#313. Equation Mod 2Doqe#WA 1ms3768kbC++14841b2024-07-14 16:14:162024-07-14 16:14:17

Judging History

你现在查看的是最新测评结果

  • [2024-07-14 16:14:17]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3768kb
  • [2024-07-14 16:14:16]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=5010;
int n,m;
bitset<N>a[N];
int x[N];
int main()
{
    cin.tie(0)->sync_with_stdio(0);
    cin>>n>>m;
    for(int i=1;i<=m;++i)
        for(int j=1;j<=n+1;++j)
        {
            int w;cin>>w;
            a[i][j]=w;
        }
    for(int i=1;i<=n;++i)
    {
        for(int j=i;j<=m;++j)
            if(a[j][i]){swap(a[j],a[i]);;break;}
        if(!a[i][i])continue;
        for(int j=1;j<=m;++j)
            if(i!=j&&a[j][i])a[j]^=a[i];
    }
    for(int i=n;i;--i)if(a[i][i])
    {
        // for(int j=1;j<=n+1;++j)
        //     cerr<<a[i][j]<<",";cerr<<endl;
        int w=0;
        for(int j=i+1;j<=n;++j)
            if(a[i][j])w^=x[j];
        w^=a[i][n+1];
        x[i]=w;
    }
    for(int i=1;i<=n;++i)cout<<x[i]<<" ";cout<<"\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3768kb

input:

100 95
0 0 0 1 1 0 1 1 1 0 0 1 0 1 1 0 0 1 1 0 1 0 1 0 0 0 1 1 0 1 1 1 0 1 0 1 0 0 0 0 1 0 0 0 1 1 0 1 1 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 1 1 0 1 1 1 0 0 0 0 1 0 1 1 1 1 1 0 0 1 0 1 1 0 1 0 1
0 0 0 1 0 0 1 1 0 0 0 0 1 0 0 1 1 0 1 0 0 0 0 0 0 0 1 1 1 1 0 1 0 1 1 0 0 0 1 1 0 0 1 1 0 1...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