QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#341951 | #313. Equation Mod 2 | Kevin5307# | WA | 2ms | 3676kb | C++20 | 644b | 2024-02-29 23:25:18 | 2024-02-29 23:25:18 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
bitset<5005> bs[5005];
int ans[5005];
int main()
{
int n,m;
cin>>n>>m;
for(int i=1;i<=m;i++)
for(int j=1;j<=n+1;j++)
{
int x;
cin>>x;
bs[i][j]=x;
}
int p=1;
for(int i=1;i<=n&&p<=m;i++)
{
if(!bs[p][i])
for(int j=p+1;j<=m;j++)
if(bs[j][i])
{
swap(bs[p],bs[j]);
break;
}
if(bs[p][i])
{
for(int j=1;j<=n;j++)
if(j!=p&&bs[j][i])
bs[j]^=bs[p];
p++;
}
}
for(int i=1;i<=m;i++)
for(int j=1;j<=n;j++)
if(bs[i][j])
ans[j]=bs[i][n+1];
for(int i=1;i<=n;i++)
cout<<ans[i]<<" ";
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3676kb
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...
output:
0 1 0 1 1 0 0 0 0 1 0 1 1 1 0 0 0 1 0 1 1 0 1 1 0 0 1 1 0 1 0 0 0 1 0 0 0 0 1 1 0 1 1 1 1 1 1 0 0 0 0 1 0 0 0 1 1 0 0 0 1 1 0 0 1 1 0 1 0 0 0 1 1 1 0 0 0 1 0 1 0 0 0 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 0 0
result:
wrong answer incorrect solution