当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

4019:Batch System

题目描述
Large distributed data center so-called “bigtable” receives a huge number of update queries every minute from servers all over the world. The engineers want to make the system works more efficiency, so they come up with a batch system for bigtable.
We can denote the data in the bigtable as an infinity text data. Every client can send commands to the bigtable server to editing the text. Once the client connects to the bigtable server, the cursor for the client is positioned before the first character of the text before performing any commands. The bigtable only supports three operations below:

When a new client connects the server, it sends all the operations to the bigtable. And then the next client can connect and perform its own operation list.
  The batch system is designed to save the traffic volume. It merges all the clients operation together to one equivalent operation list. But their engineers soon noticed that it is hard to make the resulted operation list shortest.
  They ask you, their senior programmer, to make up a solution, give the operation lists with minimum length and let the delete operations before the insert operations if possible.
输入解释
The first line contains the number of test cases. The description of T tests follow.
  The first line of each test case contains the amount of clients n (1 <= n <= 10000). You can assume the client comes exactly in the order of the input.
The description of operation list of each client follows. The first line of each operation list contains the number of operations m first (1 <= m <= 10). The next m lines contain the description of each operation in the format given above. 1 <= k <= 100000 for R and D operations, and 1 <= k <= 10 for C operations. The strings in C operations consist of latin letters and digits only.
输出解释
For each test case your program should print the result of batch system. The format of the command should be the same as the input file, except the limitations of m and k. The result should contain the least possible number of operations. The delete operations should precede the insert operations if possible. If the result contains no operations, just print 0 instead.
输入样例
1
2
4
R 4
C 3 abc
R 2
C 3 xyz
3
R 7
C 3 def
D 3
输出样例
3
R 4
D 2
C 8 abcdefyz
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-4019

最后修改于 2020-10-25T23:09:19+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
10000/5000MS(Java/Others) 65768/65768K(Java/Others)