{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"仓库里有一个机器人,他想收集n个包裹。仓库可以表示为一个坐标网格。最初,机器人停留在点(0,0)。第i个包在点上(x i,y i)。保证在同一点上没有两个包。还可以保证点(0,0)不包含包裹。\n\u003cp\u003e\n\n\n机器人存在故障,只能向上(\u0027U\u0027)和向右(\u0027R\u0027)移动。换句话说,在一次移动中,机器人可以从点(x,y)移动到点(x+1,y)或点(x,y+1)。\n\u003cp\u003e\n\n\n如上所述,机器人希望收集所有n个包(按任意顺序)。他想用最少的移动来完成。如果有几个可能的遍历,机器人想要选则字典序(字典序R \u003c U)最小的路径。\n\n\u003cp\u003e\n"}},{"title":"Input","value":{"format":"HTML","content":"输入的第一行包含一个整数t(1≤t≤100)-测试用例的数量。接下来是测试用例。\n\u003cp\u003e\n\n\n测试用例的第一行包含一个整数n(1≤n≤1000)-包的数量。\n\n\n\u003cp\u003e\n接下来的n行包含包的描述。第i个包被给出为两个整数Xi和Yi(0\u003c\u003d Xi,Yi\u003c\u003d1000)-包的x坐标和包的y坐标。\n\n\n\u003cp\u003e\n保证在同一点上没有两个包裹。还可以保证点(0,0)不包含包裹。\n\n\n\u003cp\u003e\n测试中测试用例上所有值n的总和不超过1000。"}},{"title":"Output","value":{"format":"HTML","content":"打印每个测试用例的答案。\n如果不可能从(0,0)开始以某种顺序收集所有n个包裹,请在第一行打印“NO”。\n否则,请在第一行打印\"YES”。然后打印最短路径-由字符“R”和“U”组成的字符串。在所有这些路径中,选择字典序最小的路径。"}},{"title":"Example","value":{"format":"HTML","content":"\u003cdiv class\u003d\"sample-test\"\u003e\n \u003cdiv class\u003d\"input\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Input\n \u003c/div\u003e\n \u003cpre\u003e3\n5\n1 3\n1 2\n3 3\n5 5\n4 3\n2\n1 0\n0 1\n1\n4 3\n\u003c/pre\u003e\n \u003c/div\u003e\n \u003cdiv class\u003d\"output\"\u003e\n \u003cdiv class\u003d\"title\"\u003e\n Output\n \u003c/div\u003e\n \u003cpre\u003eYES\nRUUURRRRUU\nNO\nYES\nRRRRUUU\n\u003c/pre\u003e\n \u003c/div\u003e\n\u003c/div\u003e"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003e第一组测试用例 \u003cspan class\u003d\"tex-font-style-tt\"\u003eRUUURRRRUU\u003c/span\u003e 显示如下: \u003c/p\u003e\n\u003ccenter\u003e \n \u003cimg class\u003d\"tex-graphics\" SRC\u003d\"CDN_BASE_URL/a31149feeec0cb34ef437ce0a8c19fd1?v\u003d1579751024\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e \n\u003c/center\u003e"}}]}