{"problem":{"name":"Coloring Matrix","description":{"content":"You are given $N$\\-by-$N$ matrices $A$ and $B$ where each element is $0$ or $1$.   Let $A_{i,j}$ and $B_{i,j}$ denote the element at the $i$\\-th row and $j$\\-th column of $A$ and $B$, respectively.   ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"abc298_b"},"statements":[{"statement_type":"Markdown","content":"You are given $N$\\-by-$N$ matrices $A$ and $B$ where each element is $0$ or $1$.  \nLet $A_{i,j}$ and $B_{i,j}$ denote the element at the $i$\\-th row and $j$\\-th column of $A$ and $B$, respectively.  \nDetermine whether it is possible to rotate $A$ so that $B_{i,j} = 1$ for every pair of integers $(i, j)$ such that $A_{i,j} = 1$.  \nHere, to rotate $A$ is to perform the following operation zero or more times:\n\n*   for every pair of integers $(i, j)$ such that $1 \\leq i, j \\leq N$, simultaneously replace $A_{i,j}$ with $A_{N + 1 - j,i}$.\n\n## Constraints\n\n*   $1 \\leq N \\leq 100$\n*   Each element of $A$ and $B$ is $0$ or $1$.\n*   All values in the input are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$N$\n$A_{1,1}$ $A_{1,2}$ $\\ldots$ $A_{1,N}$\n$\\vdots$\n$A_{N,1}$ $A_{N,2}$ $\\ldots$ $A_{N,N}$\n$B_{1,1}$ $B_{1,2}$ $\\ldots$ $B_{1,N}$\n$\\vdots$\n$B_{N,1}$ $B_{N,2}$ $\\ldots$ $B_{N,N}$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"abc298_b","tags":[],"sample_group":[["3\n0 1 1\n1 0 0\n0 1 0\n1 1 0\n0 0 1\n1 1 1","Yes\n\nInitially, $A$ is :\n\n0 1 1\n1 0 0\n0 1 0\n\nAfter performing the operation once, $A$ is :\n\n0 1 0\n1 0 1 \n0 0 1\n\nAfter performing the operation once again, $A$ is :\n\n0 1 0\n0 0 1\n1 1 0\n\nHere, $B_{i,j} = 1$ for every pair of integers $(i, j)$ such that $A_{i,j} = 1$, so you should print `Yes`."],["2\n0 0\n0 0\n1 1\n1 1","Yes"],["5\n0 0 1 1 0\n1 0 0 1 0\n0 0 1 0 1\n0 1 0 1 0\n0 1 0 0 1\n1 1 0 0 1\n0 1 1 1 0\n0 0 1 1 1\n1 0 1 0 1\n1 1 0 1 0","No"]],"created_at":"2026-03-03 11:01:14"}}