文章目录
T1【GDKOI 2021普及组DAY1】地图 (map)
比较显然的数学规律题,直接上代码
#include<bits/stdc++.h>
#define Fu(i,a,b) for(int i=(a);i<=(b);i++)
#define Fd(i,a,b) for(int i=(a);i>=(b);i--)
#define fre(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
using namespace std;
int n,a[2005][2005],b1,b2,num1,num2,js1,js2;
bool bj1[2005],bj2[2005];
int main(){
fre(map);
scanf("%d",&n);
Fu(i,1,n) Fu(j,1,n) scanf("%d",&a[i][j]);
if(a[1][1]){
printf("1 1");
return 0;
}
Fu(i,1,n) b1^=a[i][n],b2^=a[n][i];
Fu(i,2,n-1){
int c1=0,c2=0;
Fu(j,2,n){
c1^=a[j][i];
c2^=a[i][j];
}
bj1[i]=a[1][i]^(b1^c1);
bj2[i]=a[i][1]^(b2^c2);
}
Fu(i,2,n-1){
if(bj1[i]) num1++,js1=i;
if(bj2[i]) num2++,js2=i;
}
if(num1==0&&num2==1) printf("%d 1",js2);
else if(num1==1&&num2==0) printf("1 %d",js1);
else if(num1>1&&num2==0) printf("1 %d",n);
else if(num1==0&&num2>0) printf("%d 1",n);
else if(num1==1&&num2==1) printf("%d %d",js2,js1);
else