Questionnaire
Time limit1sMemory limit512 MB
Given n distinct positive integers, find a modulus m and residue k so that at least half the numbers are congruent to k mod m.
- Level
Hard8 of 10
- Topics
- Math, Number theory, Probability, Brute force
- Solved
- No attempts yet
Problem
To get better results in official ACM ICPC contests, the team leader came up with a questionnaire. He asked every participant whether they want to have more training.
Many people did not want more training, so the clever leader did not write down their words such as "Yes" or "No". Instead, he let everyone choose a positive integer to represent their opinion. Amazingly, all the resulting numbers were distinct.
Now the leader wants to choose a pair of positive integers () and (), and regard those people whose number is exactly modulo as "Yes", and all others as "No". If there are at least as many "Yes" answers as "No" answers, the leader can have a chance to offer more training.
Please help the team leader find such a pair of and .
Input
The first line of the input contains an integer : the number of ACM ICPC participants ().
The next line contains distinct integers , , , : the numbers chosen by the participants ().
Output
Print a single line containing two integers and . If there are several possible solutions, print any one of them.