305708: CF1078E. Negative Time Summation

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Negative Time Summation

题意翻译

题目描述 有一个无限大的网格图,在其中的$(0,0)$格子上有一个机器人。每一个格子中要么为空,要么有一个数字$0$或$1$。机器人有$9$种操作,每种操作对应一个字符,耗时$1s$。操作种类如下: $0/1$:将机器人所在的格子中的数字变为$0/1$。 $e(erase)$:将机器人所在格子清空 $s(stand)$:机器人站在当前格子不动 $l(left)/r(right)/u(up)/d(down)$:机器人向其正左/右/上/下前进一格 $t(travel)$:当机器人当前所在格子为空,我们令$x=0$,否则$x=$机器人当前所在格子中的数字$+1$。然后机器人会撤销这个操作之前的$x$次操作,你可以认为是机器人按下了$x$次$ctrl+Z$键。 我们定义一个操作序列为一个只包含$01lrudste$的字符串。当有一个操作序列需要机器人运行时,机器人会依次进行操作序列对应的操作。 比如说:现在给出的操作序列是$sr1t0$,那么: 第一次操作后,机器人停留在$(0,0)$ 第二次操作后,机器人走到了$(1,0)$ 第三次操作后,$(1,0)$格子上有一个数$1$ 第四次操作时,机器人所在格子上的数为$1$,因此撤销前两次操作。那么第四次操作后,机器人在$(0,0)$格子,而$(1,0)$格子变为空。 第五次操作后,$(0,0)$格子上有一个数$0$。 现在,科学家希望使用这一个机器人解决$A+B\ problem$。我们给出的初始局面为: ①一个正整数$A$以二进制表示,最低位在格子$(0,1)$处,从左往右位数从高到低 ②另一个正整数$B$以二进制表示,最低位在格子$(0,0)$处,从左往右位数从高到低 ③所有其他位置都是空的 ④机器人初始在$(0,0)$处 ⑤如果你其他操作的数量和小于你当前撤销操作撤销的数量,我们认为撤销操作完成之后的局面为初始局面 你需要给出一个操作序列,使得最后: ①机器人所在的位置不为空 ②如果将机器人右移直到其右侧格子为空,机器人经过的格子按照从左往右位数从高到低得到的二进制数是$A+B$的二进制表示。 注意:对于其他格子并没有限制,哪怕在操作完成之后机器人的左边为一个有数字的格子,它也不会影响最终的答案。 在每一组数据中,会给出$1000$组$a,b$,你的操作序列需要在这$1000$组询问中都得到正确答案。当然,机器人的内存不是特别大,所以你的操作序列的长度不能大于$10^5$。 输入数据 第一行一个数$t(1 \leq t \leq 1000)$表示数据组数,接下来$t$行每行两个正整数$a,b(1 \leq a , b < 2^{30})$表示一组询问。 输出数据 只需输出一行一个字符串表示操作序列。

题目描述

Everyone knows that computers become faster and faster. Recently Berland scientists have built a machine that can move itself back in time! More specifically, it works as follows. It has an infinite grid and a robot which stands on one of the cells. Each cell of the grid can either be empty or contain 0 or 1. The machine also has a program which consists of instructions, which are being handled one by one. Each instruction is represented by exactly one symbol (letter or digit) and takes exactly one unit of time (say, second) to be performed, except the last type of operation (it's described below). Here they are: - 0 or 1: the robot places this number into the cell he is currently at. If this cell wasn't empty before the operation, its previous number is replaced anyway. - e: the robot erases the number into the cell he is at. - l, r, u or d: the robot goes one cell to the left/right/up/down. - s: the robot stays where he is for a unit of time. - t: let $ x $ be $ 0 $ , if the cell with the robot is empty, otherwise let $ x $ be one more than the digit in this cell (that is, $ x = 1 $ if the digit in this cell is $ 0 $ , and $ x = 2 $ if the digit is $ 1 $ ). Then the machine travels $ x $ seconds back in time. Note that this doesn't change the instructions order, but it changes the position of the robot and the numbers in the grid as they were $ x $ units of time ago. You can consider this instruction to be equivalent to a Ctrl-Z pressed $ x $ times. For example, let the board be completely empty, and the program be sr1t0. Let the robot initially be at $ (0, 0) $ . - \[now is the moment $ 0 $ , the command is s\]: we do nothing. - \[now is the moment $ 1 $ , the command is r\]: we are now at $ (1, 0) $ . - \[now is the moment $ 2 $ , the command is 1\]: we are at $ (1, 0) $ , and this cell contains $ 1 $ . - \[now is the moment $ 3 $ , the command is t\]: we travel $ 1 + 1 = 2 $ moments back, that is, to the moment $ 1 $ . - \[now is the moment $ 1 $ , the command is 0\]: we are again at $ (0, 0) $ , and the board is clear again, but after we follow this instruction, this cell has $ 0 $ in it. We've just rewritten the history. The consequences of the third instruction have never happened. Now Berland scientists want to use their machine in practice. For example, they want to be able to add two integers. Assume that the initial state of the machine is as follows: - One positive integer is written in binary on the grid in such a way that its right bit is at the cell $ (0, 1) $ , from left to right from the highest bit to the lowest bit. - The other positive integer is written in binary on the grid in such a way that its right bit is at the cell $ (0, 0) $ , from left to right from the highest bit to the lowest bit. - All the other cells are empty. - The robot is at $ (0, 0) $ . - We consider this state to be always in the past; that is, if you manage to travel to any negative moment, the board was always as described above, and the robot was at $ (0, 0) $ for eternity. You are asked to write a program after which - The robot stands on a non-empty cell, - If we read the number starting from the cell with the robot and moving to the right until the first empty cell, this will be $ a + b $ in binary, from the highest bit to the lowest bit. Note that there are no restrictions on other cells. In particular, there may be a digit just to the left to the robot after all instructions. In each test you are given up to $ 1000 $ pairs $ (a, b) $ , and your program must work for all these pairs. Also since the machine's memory is not very big, your program must consist of no more than $ 10^5 $ instructions.

输入输出格式

输入格式


The first line contains the only integer $ t $ ( $ 1\le t\le 1000 $ ) standing for the number of testcases. Each of the next $ t $ lines consists of two positive integers $ a $ and $ b $ ( $ 1\le a, b < 2^{30} $ ) in decimal.

输出格式


Output the only line consisting of no more than $ 10^5 $ symbols from 01eslrudt standing for your program. Note that formally you may output different programs for different tests.

输入输出样例

输入样例 #1

2
123456789 987654321
555555555 555555555

输出样例 #1

0l1l1l0l0l0l1l1l1l0l1l0l1l1l0l0l0l1l0l1l1l1l0l0l0l1l0l0l0l0l1l0lr

Input

题意翻译

题目描述 有一个无限大的网格图,在其中的$(0,0)$格子上有一个机器人。每一个格子中要么为空,要么有一个数字$0$或$1$。机器人有$9$种操作,每种操作对应一个字符,耗时$1s$。操作种类如下: $0/1$:将机器人所在的格子中的数字变为$0/1$。 $e(erase)$:将机器人所在格子清空 $s(stand)$:机器人站在当前格子不动 $l(left)/r(right)/u(up)/d(down)$:机器人向其正左/右/上/下前进一格 $t(travel)$:当机器人当前所在格子为空,我们令$x=0$,否则$x=$机器人当前所在格子中的数字$+1$。然后机器人会撤销这个操作之前的$x$次操作,你可以认为是机器人按下了$x$次$ctrl+Z$键。 我们定义一个操作序列为一个只包含$01lrudste$的字符串。当有一个操作序列需要机器人运行时,机器人会依次进行操作序列对应的操作。 比如说:现在给出的操作序列是$sr1t0$,那么: 第一次操作后,机器人停留在$(0,0)$ 第二次操作后,机器人走到了$(1,0)$ 第三次操作后,$(1,0)$格子上有一个数$1$ 第四次操作时,机器人所在格子上的数为$1$,因此撤销前两次操作。那么第四次操作后,机器人在$(0,0)$格子,而$(1,0)$格子变为空。 第五次操作后,$(0,0)$格子上有一个数$0$。 现在,科学家希望使用这一个机器人解决$A+B\ problem$。我们给出的初始局面为: ①一个正整数$A$以二进制表示,最低位在格子$(0,1)$处,从左往右位数从高到低 ②另一个正整数$B$以二进制表示,最低位在格子$(0,0)$处,从左往右位数从高到低 ③所有其他位置都是空的 ④机器人初始在$(0,0)$处 ⑤如果你其他操作的数量和小于你当前撤销操作撤销的数量,我们认为撤销操作完成之后的局面为初始局面 你需要给出一个操作序列,使得最后: ①机器人所在的位置不为空 ②如果将机器人右移直到其右侧格子为空,机器人经过的格子按照从左往右位数从高到低得到的二进制数是$A+B$的二进制表示。 注意:对于其他格子并没有限制,哪怕在操作完成之后机器人的左边为一个有数字的格子,它也不会影响最终的答案。 在每一组数据中,会给出$1000$组$a,b$,你的操作序列需要在这$1000$组询问中都得到正确答案。当然,机器人的内存不是特别大,所以你的操作序列的长度不能大于$10^5$。 输入数据 第一行一个数$t(1 \leq t \leq 1000)$表示数据组数,接下来$t$行每行两个正整数$a,b(1 \leq a , b < 2^{30})$表示一组询问。 输出数据 只需输出一行一个字符串表示操作序列。

加入题单

算法标签: