Starving velociraptor X63705


Statement
 

pdf   zip

html

The 10th grade class of a certain Catalan high school is going on a field trip. Just when the bus reaches the destination and the doors open, a starving velociraptor gets in looking like it just found its favorite candy. Alas! This things happen.

However, velociraptors are very intelligent and organized animals. It knows it won’t be able to eat everyone but it’s so hungry, so it decides to eat as many people as possible as long as all of them have the exact same weight. Naturally, the superior intelligence of velociraptors allows them to compute each person’s weight with just a glimpse.

Input

Input contains several cases. Each case consists of a line with an integer 1 ≤ n ≤ 106 indicating the number of people in the bus, followed by n numbers representing the weight of each person in the order they are seated. Every weight is between 30 and 150.

Output

Print a line for each case with the maximum number of people with the same weight, followed by the weight of these people. If case of a tie, choose the greatest weight.

Public test cases
  • Input

    5 65 70 65 48 50
    4 50 50 50 50
    6 30 32 31 100 140 150

    Output

    2 65
    4 50
    1 150
    
  • Information
    Author
    Alex Alvarez
    Language
    English
    Translator
    Alex Alvarez
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++ Python
    User solutions
    C++ Python