{"problem":{"name":"D. Meeting Bahosain","description":{"content":"Essa wanted to meet the most powerful number theorist of all time: Bahosain, but Bahosain does not waste his precious time, so he gave Essa this puzzle in order to test his abilities. Given two array","description_type":"Markdown"},"platform":"Codeforces","limit":{"time_limit":1000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"CF10226D"},"statements":[{"statement_type":"Markdown","content":"Essa wanted to meet the most powerful number theorist of all time: Bahosain, but Bahosain does not waste his precious time, so he gave Essa this puzzle in order to test his abilities.\n\nGiven two arrays, the second array only has distinct elements, Essa can do the following as many times as he wants to make all numbers in first array equal.\n\nThe first line containing two space separated integers $n, m$ ($1 <= n, k <= 10^6$) represent the length of the first and second array.\n\nthe second line contains n integers represent the first array ($1 <= a [ i ] <= 10^9$)\n\nthe third line contains m integers represent the second array ($1 <= b [ i ] <= 10^9$)\n\nPrint Yes, if it's possible to make all numbers in first array equal; and No in the opposite case.\n\n## Input\n\nThe first line containing two space separated integers $n, m$ ($1 <= n, k <= 10^6$) represent the length of the first and second array.the second line contains n integers represent the first array ($1 <= a [ i ] <= 10^9$)the third line contains m integers represent the second array ($1 <= b [ i ] <= 10^9$)\n\n## Output\n\nPrint Yes, if it's possible to make all numbers in first array equal; and No in the opposite case.\n\n[samples]","is_translate":false,"language":"English"},{"statement_type":"Markdown","content":"**Definitions**  \nLet $ L \\in \\mathbb{Z} $ be the number of levels, $ 1 \\leq L \\leq 134 $.  \nFor each level $ \\ell \\in \\{1, \\dots, L\\} $, let $ (r_\\ell, c_\\ell) \\in \\{1, \\dots, 12\\}^2 $ denote the robot's starting position.  \nLet $ G $ be a fixed $ 12 \\times 12 $ grid with cells classified as:  \n- **Blocked** (fully black): impassable,  \n- **White**: passable,  \n- **Crossed**: passable and target.  \n\nLet $ T \\subseteq \\{1, \\dots, 12\\}^2 $ be the set of crossed cells (target positions).  \n\n**Constraints**  \n1. The robot starts on a non-blocked cell: $ (r_\\ell, c_\\ell) \\notin \\text{Blocked} $.  \n2. The robot may move in directions $ \\{U, D, L, R\\} $, but:  \n   - A move is invalid if it would take the robot to a blocked cell or outside the grid.  \n   - Invalid moves are ignored (robot stays in place).  \n3. The goal is to reach any cell in $ T $ in at most 1000 moves.  \n\n**Objective**  \nFor each level $ \\ell $, output:  \n- An integer $ n_\\ell \\in \\{0, 1, \\dots, 1000\\} $, the number of moves,  \n- A string $ s_\\ell \\in \\{U, D, L, R\\}^{n_\\ell} $, the sequence of moves,  \nsuch that the robot, starting from $ (r_\\ell, c_\\ell) $ and applying $ s_\\ell $ step-by-step (ignoring invalid moves), ends on a cell in $ T $.","is_translate":false,"language":"Formal"}],"meta":{"iden":"CF10226D","tags":[],"sample_group":[],"created_at":"2026-03-03 11:00:39"}}