{"trustable":false,"prependHtml":"\u003cstyle type\u003d\"text/css\"\u003e\n section pre {\n display: block;\n padding: 9.5px;\n margin: 0 0 10px;\n font-size: 13px;\n line-height: 1.42857143;\n word-break: break-all;\n word-wrap: break-word;\n color: #333;\n background: rgba(255, 255, 255, 0.5);\n border: 1px solid #ccc;\n border-radius: 6px;\n }\n\u003c/style\u003e\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027\\\\(\u0027, right: \u0027\\\\)\u0027, display: false},\n {left: \u0027\\\\[\u0027, right: \u0027\\\\]\u0027, display: true}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"题目描述","value":{"format":"MD","content":"lcqwq 和 qwqaq 准备玩一个游戏。\n\n有一个 $H$ 行 $W$ 列的棋盘,在 $(s_r,s_c)$ 处有一个棋子。\n\n两人轮流进行 $n$ 步操作,lcqwq 是先手。在第 $i$ 步,先手可以按照 $S_i$ 移动棋子或者不动;后手可以按照 $T_i$ 移动棋子或者不动。\n\n其中 $S_i,T_i\\in\\{U,D,L,R\\}$ 分别表示向上,下,左,右移动一格。\n\nlcqwq 希望棋子某时刻走出棋盘,qwqaq 希望棋子始终在棋盘上。\n\n若两人均按照最优策略走,棋子能否 **始终在棋盘上** ?\n"}},{"title":"Constraints","value":{"format":"MD","content":"\u003csection\u003e\n \u003cul\u003e\n \u003cli\u003e\u003cvar\u003e\\(2 \\leq H,W \\leq 2 \\times 10^5\\)\u003c/var\u003e\u003c/li\u003e\n \u003cli\u003e\u003cvar\u003e\\(2 \\leq N \\leq 2 \\times 10^5\\)\u003c/var\u003e\u003c/li\u003e\n \u003cli\u003e\u003cvar\u003e\\(1 \\leq s_r \\leq H\\)\u003c/var\u003e\u003c/li\u003e\n \u003cli\u003e\u003cvar\u003e\\(1 \\leq s_c \\leq W\\)\u003c/var\u003e\u003c/li\u003e\n \u003cli\u003e\u003cvar\u003e\\(|S|\u003d|T|\u003dN\\)\u003c/var\u003e\u003c/li\u003e\n \u003cli\u003e\u003cvar\u003e\\(S\\)\u003c/var\u003e and \u003cvar\u003e\\(T\\)\u003c/var\u003e consists of the four kinds of letters \u003ccode\u003eL\u003c/code\u003e, \u003ccode\u003eR\u003c/code\u003e, \u003ccode\u003eU\u003c/code\u003e and \u003ccode\u003eD\u003c/code\u003e.\u003c/li\u003e\n \u003c/ul\u003e\n\u003c/section\u003e"}},{"title":"Input","value":{"format":"MD","content":"\u003csection\u003e\n \u003cp\u003eInput is given from Standard Input in the following format:\u003c/p\u003e\n \u003cpre\u003e\u003cvar\u003e\\(H\\)\u003c/var\u003e \u003cvar\u003e\\(W\\)\u003c/var\u003e \u003cvar\u003e\\(N\\)\u003c/var\u003e\n\u003cvar\u003e\\(s_r\\)\u003c/var\u003e \u003cvar\u003e\\(s_c\\)\u003c/var\u003e\n\u003cvar\u003e\\(S\\)\u003c/var\u003e\n\u003cvar\u003e\\(T\\)\u003c/var\u003e\n\u003c/pre\u003e\n\u003c/section\u003e"}},{"title":"Output","value":{"format":"MD","content":"\u003csection\u003e\n \u003cp\u003eIf the piece will remain on the grid at the end of the game, print \u003ccode\u003eYES\u003c/code\u003e; otherwise, print \u003ccode\u003eNO\u003c/code\u003e.\u003c/p\u003e\n\u003c/section\u003e"}},{"title":"Sample 1","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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 3 3\n2 2\nRRL\nLUD\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eYES\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003csection\u003e\n\u003c/section\u003e\u003csection\u003e\n \u003cp\u003eHere is one possible progress of the game:\u003c/p\u003e\n \u003cul\u003e\n \u003cli\u003elcqwq moves the piece right. The piece is now at \u003cvar\u003e\\((2,3)\\)\u003c/var\u003e.\u003c/li\u003e\n \u003cli\u003eqwqaq moves the piece left. The piece is now at \u003cvar\u003e\\((2,2)\\)\u003c/var\u003e.\u003c/li\u003e\n \u003cli\u003elcqwq does not move the piece. The piece remains at \u003cvar\u003e\\((2,2)\\)\u003c/var\u003e.\u003c/li\u003e\n \u003cli\u003eqwqaq moves the piece up. The piece is now at \u003cvar\u003e\\((1,2)\\)\u003c/var\u003e.\u003c/li\u003e\n \u003cli\u003elcqwq moves the piece left. The piece is now at \u003cvar\u003e\\((1,1)\\)\u003c/var\u003e.\u003c/li\u003e\n \u003cli\u003eqwqaq does not move the piece. The piece remains at \u003cvar\u003e\\((1,1)\\)\u003c/var\u003e.\u003c/li\u003e\n \u003c/ul\u003e\n\u003c/section\u003e"}},{"title":"Sample 2","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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\u003e4 3 5\n2 2\nUDRRR\nLLDUD\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eNO\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003csection\u003e\n\u003c/section\u003e\u003csection\u003e\n\u003c/section\u003e"}},{"title":"Sample 3","value":{"format":"MD","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\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\u003e5 6 11\n2 1\nRLDRRUDDLRL\nURRDRLLDLRD\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003eNO\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\u003csection\u003e\n\u003c/section\u003e\u003csection\u003e\n\u003c/section\u003e"}}]}