{"trustable":false,"sections":[{"title":"","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n 老师做团建\n \u003cbr\u003e如果一个机器人试图移出仓库区域,则机器人会撞墙,如果两个机器人试图占据同一地点,它们会彼此撞毁。\n \u003c/div\u003e在现代化的仓库中,机器人用于取货。 需要仔细规划以确保机器人到达目的地而不会相互撞击。 当然,所有仓库是矩形的,所有机器人占据一个区域。 假设有N个机器人,从1到N编号。已知每个机器人的位置和方向,而且机器人会无意识的遵循所有指令,会按照它们的顺序进行处理。两个机器人不会同时移动; 机器人总是在下一个机器人开始移动之前完成其移动。\u003c/p\u003e\n如果机器人试图移动到仓库区域外,机器人会与墙壁碰撞,如果机器人试图走到同一地点,则两个机器人会相互撞击。\n"}},{"title":"Input","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n The first line of input is K, the number of test cases. Each test case starts with one line consisting of two integers, 1 \u0026lt;\u003d A, B \u0026lt;\u003d 100, giving the size of the warehouse in meters. A is the length in the EW-direction, and B in the NS-direction. \n \u003cbr\u003eThe second line contains two integers, 1 \u0026lt;\u003d N, M \u0026lt;\u003d 100, denoting the numbers of robots and instructions respectively. \n \u003cbr\u003eThen follow N lines with two integers, 1 \u0026lt;\u003d Xi \u0026lt;\u003d A, 1 \u0026lt;\u003d Yi \u0026lt;\u003d B and one letter (N, S, E or W), giving the starting position and direction of each robot, in order from 1 through N. No two robots start at the same position. \n \u003cbr\u003e\n \u003ccenter\u003e\n \u003cimg SRC\u003d\"CDN_BASE_URL/5c7adf6dcd1e44166dc55094bc35f881?v\u003d1562820119\"\u003e \n \u003cbr\u003eFigure 1: The starting positions of the robots in the sample warehouse\n \u003c/center\u003e \n \u003cbr\u003eFinally there are M lines, giving the instructions in sequential order. \n \u003cbr\u003eAn instruction has the following format: \n \u003cbr\u003e\u0026lt; robot #\u0026gt; \u0026lt; action\u0026gt; \u0026lt; repeat\u0026gt; \n \u003cbr\u003eWhere \n \u003caction\u003e\n is one of \n \u003cbr\u003e\n \u003cul\u003e\n \u003cli\u003eL: turn left 90 degrees, \u003cbr\u003e\u003c/li\u003e\n \u003cli\u003eR: turn right 90 degrees, or \u003cbr\u003e\u003c/li\u003e\n \u003cli\u003eF: move forward one meter,\u003c/li\u003e\n \u003c/ul\u003e \n \u003cbr\u003eand 1 \u0026lt;\u003d \u0026lt; repeat\u0026gt; \u0026lt;\u003d 100 is the number of times the robot should perform this single move.\n \u003c/action\u003e\n \u003c/div\u003e第一行输入为k表示样例个数,每个样例第一行有两个整数:A和B表示区域大小。A为EW方向上的长度,B表示NS方向上的长度。第二行表示两个整数N,M分别表示机器人个数和指令个数。接下来N行表示1-N个机器人每个机器人的初始位置和方向,每个机器人的位置一定是不同的。接下来M行,表示的是每一个指令,格式为:机器人编号 方向 重复次数。"}},{"title":"Output","value":{"format":"HTML","content":"\n \u003cdiv class\u003d\"ptx\" lang\u003d\"en-US\"\u003e\n Output one line for each test case: \n \u003cbr\u003e\n \u003cul\u003e\n \u003cli\u003eRobot i crashes into the wall, if robot i crashes into a wall. (A robot crashes into a wall if Xi \u003d 0, Xi \u003d A + 1, Yi \u003d 0 or Yi \u003d B + 1.) \u003cbr\u003e\u003c/li\u003e\n \u003cli\u003eRobot i crashes into robot j, if robots i and j crash, and i is the moving robot. \u003cbr\u003e\u003c/li\u003e\n \u003cli\u003eOK, if no crashing occurs.\u003c/li\u003e\n \u003c/ul\u003e \n \u003cbr\u003eOnly the first crash is to be reported.\n \u003c/div\u003e"}},{"title":"Sample Input","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003e4\n5 4\n2 2\n1 1 E\n5 4 W\n1 F 7\n2 F 7\n5 4\n2 4\n1 1 E\n5 4 W\n1 F 3\n2 F 1\n1 L 1\n1 F 3\n5 4\n2 2\n1 1 E\n5 4 W\n1 L 96\n1 F 2\n5 4\n2 3\n1 1 E\n5 4 W\n1 F 4\n1 L 1\n1 F 20\u003c/pre\u003e"}},{"title":"Sample Output","value":{"format":"HTML","content":"\u003cpre class\u003d\"sio\"\u003eRobot 1 crashes into the wall\nRobot 1 crashes into robot 2\nOK\nRobot 1 crashes into robot 2\u003c/pre\u003e"}}]}