#include #include #include using namespace std; int N,Q; int A[2<<17],B[2<<17]; long T[2<<17]; int R[2<<17],C[2<<17]; int ans[2<<17]; void solve() { for(int i=0;ih||C[i]>w)ans[i]=T[i]%2; else { if(R[i]+C[i]-1>T[i])ans[i]=T[i]%2; else { if(A[1]==0)ans[i]=1-(R[i]+C[i])%2; else ans[i]=(R[i]+C[i])%2; } } } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); /* mt19937 rng; N=5; while(true) { for(int i=0;i<5;i++)A[i]=rng()%2,B[i]=rng()%2; int X[5][5]={}; for(int i=0;i<5;i++)X[0][i]=A[i]; for(int i=1;i<5;i++)X[i][0]=B[i]; for(int t=0;t<=10;t++) { Q=N*N; for(int i=0;i=2?0:1; } } cout<<"AC"<>N; for(int i=0;i>A[i]; for(int i=1;i>B[i]; cin>>Q; for(int i=0;i>T[i]>>R[i]>>C[i]; R[i]--,C[i]--; } solve(); for(int i=0;i