Refrain (Easy)
Medium
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Consider a sequence of n integers ranging from 1 to m. A subsequence of consecutive numbers is termed a refrain if the product of its length and the number of times it appears in the sequence is maximized.
Your task is to identify the refrain in the given sequence.
Input
The first line of input contains two integers: n and m (1 ≤ n ≤ 150, 1 ≤ m ≤ 10).
The second line provides n integers, each between 1 and m.
Output
The output should consist of three lines: - The first line should display the product of the refrain's length and its number of occurrences. - The second line should show the length of the refrain. - The third line should present the sequence that constitutes the refrain.
Examples
Input #1
Answer #1
Submissions 297
Acceptance rate 13%