题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1923

  懒得贴题目了......这就是解一个异或方程组的裸题......

  YY了一下异或方程就没毛病了!

  感受了一下bitset的力量噢噢噢!!!!!!

 #include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<cctype>
#include<bitset>
using namespace std;
const int maxn=;
const int maxm=; int N,M;
bool b[maxm],x[maxm];
char s[maxn];
bitset<maxn>a[maxm]; void data_in()
{
scanf("%d%d",&N,&M);
for(int i=;i<=M;i++){
scanf("%s",s+);
for(int j=;j<=N;j++) a[i][j]=s[j]-'';
scanf("%s",s+);
b[i]=s[]-'';
}
}
int Gauss()
{
int i=,j=,re=;
while(i<=M&&j<=N){
re=max(re,i);
if(!a[i][j]){
int tmp=;
for(int r=i+;r<=M;r++)
if(a[r][j]) { tmp=r; break; }
if(!tmp) return ;
re=max(re,tmp);
swap(a[i],a[tmp]); swap(b[i],b[tmp]);
}
for(int r=i+;r<=M;r++){
if(!a[r][j]) continue;
a[r]^=a[i],b[r]^=b[i];
}
i++,j++;
}
if(j<=N) return ;
for(int r=N;r>=;r--){
x[r]=b[r];
for(int rr=r-;rr>=;rr--)
b[rr]^=*a[rr][r]*x[r];
}
return re;
}
void work()
{
int ans=;
if(ans=Gauss()){
printf("%d\n",ans);
for(int i=;i<=N;i++)
puts(x[i]?"?y7M#":"Earth");
}
else puts("Cannot Determine");
}
int main()
{
data_in();
work();
return ;
}
05-12 20:08