{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] \u003d 0 (1 \u0026lt;\u003d i, j \u0026lt;\u003d N). \n \u003cbr\u003e \n \u003cbr\u003eWe can change the matrix in the following way. Given a rectangle whose upper-left corner is (x1, y1) and lower-right corner is (x2, y2), we change all the elements in the rectangle by using \"not\" operation (if it is a \u00270\u0027 then change it into \u00271\u0027 otherwise change it into \u00270\u0027). To maintain the information of the matrix, you are asked to write a program to receive and execute two kinds of instructions. \n \u003cbr\u003e \n \u003cbr\u003e1. C x1 y1 x2 y2 (1 \u0026lt;\u003d x1 \u0026lt;\u003d x2 \u0026lt;\u003d n, 1 \u0026lt;\u003d y1 \u0026lt;\u003d y2 \u0026lt;\u003d n) changes the matrix by using the rectangle whose upper-left corner is (x1, y1) and lower-right corner is (x2, y2). \n \u003cbr\u003e2. Q x y (1 \u0026lt;\u003d x, y \u0026lt;\u003d n) querys A[x, y]. \n \u003cbr\u003e\n \u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n The first line of the input is an integer X (X \u0026lt;\u003d 10) representing the number of test cases. The following X blocks each represents a test case. \n \u003cbr\u003e \n \u003cbr\u003eThe first line of each block contains two numbers N and T (2 \u0026lt;\u003d N \u0026lt;\u003d 1000, 1 \u0026lt;\u003d T \u0026lt;\u003d 50000) representing the size of the matrix and the number of the instructions. The following T lines each represents an instruction having the format \"Q x y\" or \"C x1 y1 x2 y2\", which has been described above. \n \u003cbr\u003e\n \u003c/div\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n For each querying output one line, which has an integer representing A[x, y]. \n \u003cbr\u003e \n \u003cbr\u003eThere is a blank line between every two continuous test cases. \n \u003cbr\u003e\n \u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e1\n2 10\nC 2 1 2 2\nQ 2 2\nC 2 1 2 1\nQ 1 1\nC 1 1 2 1\nC 1 2 1 2\nC 1 1 2 2\nQ 1 1\nC 1 1 2 1\nQ 2 1\n\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e1\n0\n0\n1\n\u003c/pre\u003e"}},{"title":"Translate","value":{"format":"HTML","content":"有一个N*N的矩阵,元素值只可能是0或1。现在有两种操作:\n\u003cbr\u003e\n\u003cbr\u003e\n1.C x1 y1 x2 y2:将矩形(x1,y1,x2,y2)的元素全部取反。\n\u003cbr\u003e\n2.Q x y:查询(x,y)处的值。\n\u003cbr\u003e\n\u003cbr\u003e\n输入数据:\n\u003cbr\u003e\n第一行给出测试数据的组数X,接下来有X组数据,每组数据的第一行有两个整数N和T。N表示矩阵的边长,T表示操作的次数。N\u003c\u003d1000,T\u003c\u003d50000.接下来T行操作,如上所示。\n\u003cbr\u003e\n\u003cbr\u003e\n输出数据:\n\u003cbr\u003e\n对于每组数据的每次查询,输出一个整数,表示查询的结果。"}}]}