#P6808. [BalticOI 2010] Candies (Day2)
[BalticOI 2010] Candies (Day2)
Description
Given a sequence of length .
An integer can be represented if and only if you can pick any numbers from the sequence such that .
You need to modify one number in the sequence so that as many integers as possible can be represented.
Input Format
The first line contains an integer .
The second line contains integers .
Output Format
Output one line with two integers , separated by a space.
This means changing a number in the sequence to .
If there are multiple solutions, output the smallest possible . If there are still multiple solutions when is minimized, output the smallest possible .
4
1 3 4 4
4 9
5
3 3 3 3 3
3 1
Hint
For of the testdata, it is guaranteed that and .
This problem is translated from BalticOI 2010 Day2 T2 Candies。
Translated by ChatGPT 5
京公网安备 11011102002149号