|
||||||||||
Front compressionTime Limit: 5000/5000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others)Total Submission(s): 3556 Accepted Submission(s): 1215 Problem Description Front compression is a type of delta encoding compression algorithm whereby common prefixes and their lengths are recorded so that they need not be duplicated. For example: The size of the input is 43 bytes, while the size of the compressed output is 40. Here, every space and newline is also counted as 1 byte. Given the input, each line of which is a substring of a long string, what are sizes of it and corresponding compressed output? Input There are multiple test cases. Process to the End of File. The first line of each test case is a long string S made up of lowercase letters, whose length doesn't exceed 100,000. The second line contains a integer 1 ¡Ü N ¡Ü 100,000, which is the number of lines in the input. Each of the following N lines contains two integers 0 ¡Ü A < B ¡Ü length(S), indicating that that line of the input is substring [A, B) of S. Output For each test case, output the sizes of the input and corresponding compressed output. Sample Input
Sample Output
Author Zejun Wu (watashi) Source | ||||||||||
|