#P6817. [PA 2013] Filary
[PA 2013] Filary
Problem Description
Given a sequence of length , choose numbers such that these numbers have the same remainder modulo , where .
Find the maximum possible , and under the condition that is maximized, maximize .
Input Format
The first line contains a positive integer .
The second line contains positive integers representing the sequence .
Output Format
Output one line with two numbers .
6
7 4 10 8 7 1
5 3
Hint
Constraints: , . It is guaranteed that a solution exists, and it is guaranteed that not all are equal.
Translated by ChatGPT 5