1#include <cstdio>2#include <iostream>3 using namespacestd;4 intn,m,a[ the][ the],st=1;5 Charch[6009];6 BOOLGaointA1)7 {8 for(inti=st;i<=a1;i++)9 {Ten intK; One for(k=i;k<=a1;k++) A if(A[k][i]) - Break; - if(k==a1+1) the { -st=i; - return 0; - } + for(intj=1; j<=n+1; j + +) - swap (a[i][j],a[k][j]); +k=A[i][i]; A for(intj=1; j<=m;j++) at if(i!=j&&A[j][i]) - { -k=A[j][i]; - for(intL=1; l<=n+1; l++) -A[j][l]= (a[j][l]-a[i][l]*k+2)%2; - } in if(i==N) - return 1; to } + } - intMain () the { *scanf"%d%d",&n,&m); $ for(intI=1; i<=m;i++)Panax Notoginseng { -scanf"%s", ch+1); the for(intj=1; j<=n;j++) +a[i][j]=ch[j]-'0'; Ascanf"%d", &a[i][n+1]); the } + for(inti=n;i<=m;i++) - if(Gao (i)) $ { $printf"%d\n", i); - for(intI=1; i<=n;i++) - if(a[i][n+1]%2) theprintf"? y7m#\n"); - ElseWuyiprintf"earth\n"); the return 0; - } Wuprintf"cannot determine\n"); - return 0; About}
According to the problem is the solution equation, so the Gaussian elimination method
Bzoj 1923: [Sdoi2010] alien thousand foot worm