P6817 [PA 2013] Filary
Description
Given a sequence $a$ of length $n$, choose $k$ numbers such that these $k$ numbers have the same remainder modulo $m$, where $m\geq 2$.
Find the maximum possible $k$, and under the condition that $k$ is maximized, maximize $m$.
Input Format
The first line contains a positive integer $n$.
The second line contains $n$ positive integers representing the sequence $a$.
Output Format
Output one line with two numbers $k,m$.
Explanation/Hint
Constraints: $2\leq n\leq 10^5$, $1\leq a_i\leq 10^7$. It is guaranteed that a solution exists, and it is guaranteed that not all $a_i$ are equal.
Translated by ChatGPT 5