{"trustable":true,"prependHtml":"\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e\nYesterday, my teacher taught me about bit operators: and (\u0026amp;), or (|), xor (^). I generated a number table a[N], and wrote a program to calculate the matrix table b[N][N] using three kinds of bit operator. I thought my achievement would get teacher\u0027s attention.\n\u003c/p\u003e\n\u003cp\u003e\nThe key function is the code showed below.\n\u003c/p\u003e\n\u003cpre\u003evoid calculate(int a[N], int b[N][N]) {\n\tfor (int i \u003d 0; i \u0026lt; N; ++i) {\n\t\tfor (int j \u003d 0; j \u0026lt; N; ++j) {\n\t\t\tif (i \u003d\u003d j) b[i][j] \u003d 0;\n\t\t\telse if (i % 2 \u003d\u003d 1 \u0026amp;\u0026amp; j % 2 \u003d\u003d 1) b[i][j] \u003d a[i] | a[j];\n\t\t\telse if (i % 2 \u003d\u003d 0 \u0026amp;\u0026amp; j % 2 \u003d\u003d 0) b[i][j] \u003d a[i] \u0026amp; a[j];\n\t\t\telse b[i][j] \u003d a[i] ^ a[j];\n\t\t}\n\t}\n}\n\u003c/pre\u003e\n\u003cp\u003e\nThere is no doubt that my teacher raised lots of interests in my work and was surprised to my talented programming skills. After deeply thinking, he came up with another problem: if we have the matrix table b[N][N] at first, can you check whether corresponding number table a[N] exists?\n\u003c/p\u003e\n\u003ch4\u003eInput\u003c/h4\u003e\n\u003cp\u003e\nThere are multiple test cases.\n\u003c/p\u003e\n\u003cp\u003e\nFor each test case, the first line contains an integer N, indicating the size of the matrix. (1 ≤ N ≤ 500).\n\u003c/p\u003e\n\u003cp\u003e\nThe next N lines, each line contains N integers, the jth integer in ith line indicating the element b[i][j] of matrix. (0 ≤ b[i][j] ≤ 2 ^ 31 - 1)\n\u003c/p\u003e\n\u003ch4\u003eOutput\u003c/h4\u003e\n\u003cp\u003e\nFor each test case, output \"YES\" if corresponding number table a[N] exists; otherwise output \"NO\".\n\u003c/p\u003e\n\u003ch4\u003eSample\u003c/h4\u003e\n\u003ctable class\u003d\"vjudge_sample\"\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\n0 4\n4 0\n3\n0 1 24\n1 0 86\n24 86 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\nNO\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\n"}}]}