{"problem":{"name":"[ICPC 2021 Nanjing R] Oops, It's Yesterday Twice More","description":{"content":"After the great success in 2018, 2019, and 2020, Nanjing University of Aeronautics and Astronautics (NUAA) will host the $\\textit{International Collegiate Programming Contest}$ (ICPC) Nanjing regional","description_type":"Markdown"},"platform":"Luogu","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":{"LuoguStyle":"P2"},"is_remote":true,"is_sync":true,"sync_url":null,"sign":"LGP9840"},"statements":[{"statement_type":"Markdown","content":"After the great success in 2018, 2019, and 2020, Nanjing University of Aeronautics and Astronautics (NUAA) will host the $\\textit{International Collegiate Programming Contest}$ (ICPC) Nanjing regional for the fourth time.\n\nTeam $\\textbf{\\textit{Power of Two}}$ and team $\\textbf{\\textit{Three Hold Two}}$ won the champion for Tsinghua University in 2018 and 2019. In 2020, team $\\textbf{\\textit{Inverted Cross}}$ from Peking University won the champion. In 2021, there are around $700$ teams including $\\textbf{the defending champion}$ participating in the contest. We are so excited to see who will win this year!\n\nAlthough we can't gather in Nanjing this time due to the pandemic, we should still be grateful for the hard work done by all staff and volunteers for this contest. Thank you all for your great contribution to this contest!\n\nIn the 2018 contest, problem K, $\\textbf{\\textit{Kangaroo Puzzle}}$, requires the contestants to construct an operation sequence for the game:\n\n> The puzzle is a grid with $n$ rows and $m$ columns ($1 \\le n, m \\le 20$) and there are some (at least $2$) kangaroos standing in the puzzle. The player's goal is to control them to get together. There are some walls in some cells and the kangaroos cannot enter the cells with walls. The other cells are empty. The kangaroos can move from an empty cell to an adjacent empty cell in four directions: up, down, left, and right.\n>\n> There is exactly one kangaroo in every empty cell in the beginning and the player can control the kangaroos by pressing the button U, D, L, R on the keyboard. The kangaroos will move simultaneously according to the button you press.\n>\n> The contestant needs to construct an operating sequence of at most $5 \\times 10^4$ steps consisting of U, D, L, R only to achieve the goal.\n\nIn the 2020 contest, problem A, $\\textbf{\\textit{Ah, It's Yesterday Once More}}$, requires the contestants to construct an input map to hack the following code of the problem described before:\n\n```cpp\n#include <bits/stdc++.h>\nusing namespace std;\nstring s = \"UDLR\";\nint main()\n{\n  srand(time(NULL));\n  for (int i = 1; i <= 50000; i++) putchar(s[rand() % 4]);\n  return 0;\n}\n```\n\nNow in the 2021 contest, Paimon prepares another version of the problem for you. You are given a grid with $n$ rows and $n$ columns ($2 \\leq n \\leq 500$). All cells are empty and there is one kangaroo standing in each cell.\n\nSimilarly, you can control the kangaroos by pressing the button U, D, L, R on the keyboard. The kangaroos will move simultaneously according to the button you press. Specifically, for any kangaroo located in the cell on the $i$-th row and the $j$-th column, indicated by $(i,j)$:\n\n- Button U: it will move to $(i-1,j)$ if $i>1$. Otherwise, it will stay in the same grid.\n- Button D: it will move to $(i+1,j)$ if $i<n$. Otherwise, it will stay in the same grid.\n- Button L: it will move to $(i,j-1)$ if $j>1$. Otherwise, it will stay in the same grid.\n- Button R: it will move to $(i,j+1)$ if $j<n$. Otherwise, it will stay in the same grid.\n\nYou need to construct an operating sequence consisting only of characters `U`, `D`, `L`, and `R`. After applying it, you must make sure every kangaroo will gather at the specific cell $(a,b)$. The length of the operating sequence cannot exceed $3(n-1)$.\n\n## Input\n\nThere is only one test case in each test file.\n\nThe first and only line of the input contains three integers $n$, $a$, $b$ ($2 \\leq n \\leq 500$, $ 1 \\leq a,b \\leq n$) indicating the size of the grid and the target cell.\n\n## Output\n\nOutput a string consisting only of characters `U`, `D`, `L` and `R` in one line. And its length mustn't exceed $3(n-1)$. It can be proved that the answer always exists.\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"LGP9840","tags":["2021","Special Judge","O2优化","ICPC","南京"],"sample_group":[["3 3 3\n","RRDD"],["4 3 2\n","DLDLDLUR"]],"created_at":"2026-03-03 11:09:25"}}