1942 - I2P(II)2020_Yang_Lab1 Scoreboard

Time

2020/03/13 13:20:00 2020/03/13 15:20:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12602 OuQ String
12669 Another Text Editor

12602 - OuQ String   

Description

Define the level 1 string s1 = “OuQ”,
and the level k string sk = “O” + sk1 + “u” + sk1 + “Q”.

For example:

  • s2 = “O” + s1 + “u” + s1 + “Q” = “OOuQuOuQQ”
  • s3 = “OOOuQuOuQQuOOuQuOuQQQ”

Given 3 integeres k,l,r.
Please find all characters of sk[l],sk[l+1],...sk[r1],sk[r]

Input

There’re multiple testcases in input.
Three integers k,l,r on each line.

  • ≤ ≤ 50
  • ≤ ≤ length of sk
  • ≤ |rl+1≤ 100

Output

For each testcase, print |rl+1| characters,sk[l],sk[l+1],...sk[r1],sk[r], for a line.

Remember ‘\n’ on the end of each line.

Sample Input  Download

Sample Output  Download

Tags




Discuss




12669 - Another Text Editor   

Description

In this problem we simulate a simple text editor. Given a series of keyboard input, output the final text content. Initially, the text content is empty and the cursor is at the beginning of the line. The user can:

  1. Insert a lower-case character ('a-z') before the cursor, denoted as a lower-case character.

  2. Erase an character before the cursor, denoted as B.

  3. Move the cursor to the right one character at a time, denoted as R.

  4. Move the cursor to the left one character at a time, denoted as L.

  5. Move the cursor to the beginning of the line, denoted as H.

  6. Move the cursor to the end of the line, denoted as E.

  7. Move all characters before the cursor to the end without changing cursor position, denoted as M

  8. Move all characters after the cursor to the beginning without changing cursor position, denoted as N

Hints

In this problem, you are asked to use doubly linked list to reduce the time complexity.

Remember to free memory when a linked list node is deleted. If you get Runtime Error on test case, probably there is something wrong with the pointers or there is memory leak in your program.

Make sure the time complexity is O(1) for each operation, otherwise you may get Time limit exceed

Input

The first line is an integer T (1 <= T <= 50), meaning that there are T subtasks in the input.

In each subtask, there are two lines. The first line is an integer N(1<= N <= 10^6), being the length of the series of keyboard input. The next line is a string of length N, being the series of keyboard input.

It is guaranteed that L and B will not occur when the cursor is in the left-most position, R will not occur when the cursor is in the right-most position.

Output

For each subtask, output the final text content in a single line.

Sample Input  Download

Sample Output  Download

Tags

qq



Discuss