[Solution] Mark and His Unfinished Essay Codeforces Solution
One night, Mark realized that there is an essay due tomorrow. He hasn't written anything yet, so Mark decided to randomly copy-paste substrings from the prompt to make the essay.
More formally, the prompt is a string of initial length . Mark will perform the copy-pasting operation times. Each operation is described by two integers and , which means that Mark will append letters to the end of string . Note that the length of increases after this operation.
Of course, Mark needs to be able to see what has been written. After copying, Mark will ask queries: given an integer , determine the -th letter of the final string .
The first line contains a single integer () — the number of test cases.
The first line of each test case contains three integers , , and (, , and ) — the length of the
Mark and the Online Exam Codeforces Solution
Mark and Professor Koro Codeforces Solution
Mark and Lightbulbs Codeforces Solution
Mark and His Unfinished Essay Codeforces Solution
Mark the Dust Sweeper Codeforces Solution
Mark the Photographer Codeforces Solution
initial string , the number of copy-pasting operations, and the number of queries, respectively.
The second line of each test case contains a single string of length . It is guaranteed that only contains lowercase English letters.
The following lines describe the copy-pasting operation. Each line contains two integers and (). It is also guaranteed that does not exceed the current length of .
The last lines of each test case describe the queries. Each line contains a single integer (). It is also guaranteed that does not exceed the final length of .
It is guaranteed that the sum of and across all test cases does not exceed and , respectively.
For each query, print the -th letter of the final string .
No comments:
Post a Comment