Tester: Jingbo Shang
Editorialist: Jingbo Shang
A string S is repeated P times and its characters are sorted in the alphabetic order. Find out the Nth character for Q different queries.
It is important to find out that you do not need to construct the repeated string for the queries. As long as you have the number of different characters, you should be able to answer those queries.
Therefore, we can simply use an array to count the occurrences of all characters, i.e. cnt[c] stands for the number of occurrences of character c in the repeated string. To answer the queries, one can go through the cnt array in the alphabetic order and check the occurrence.
AUTHOR’S AND TESTER’S SOLUTIONS:
Solutions will be available soon.