QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 10

#6078. Filary [B]

Statistics

工程师巴伊塔扎尔打算在巴伊特大峡谷上建一座桥。这座桥将由强大的混凝土柱子支撑。

柱子是高度为某个 bajtometr(字节米)整数倍的圆柱体。所有柱子必须在地面以上露出相同的高度(至少一个 bajtometr),否则桥面将不平坦。我们假设桥下的地面已经被完美地夷平。

每根柱子也必须以一个非负的 bajtometr 整数埋入地下,或者用超耐久砂浆固定在地面上——在第二种情况下,其底部与地面接触。建筑规范要求,埋入地下的部分长度必须是某个自然数 $m$ 的倍数,且 $m$ 必须大于 1——否则桥将容易产生危险的震动。这个数 $m$ 同时也是桥的强度系数。

不幸的是,负责生产混凝土块的公司事先并未收到全部技术规范。因此,并非所有提供的柱子都可以用于桥的建设。

巴伊塔扎尔首先关心的是让桥尽可能地长,因此他会选择一个使得可以选出最多柱子且它们高度模 $m$ 余数相同的 $m$ 值。如果有多个这样的 $m$ 值使得使用的柱子数量一样多,巴伊塔扎尔希望桥的结构尽可能强固,因此他会选择这些 $m$ 值中最大的那个。

输入格式

输入的第一行包含一个整数 $n$($2 \le n \le 100,000$),表示公司提供的柱子数量。接下来的第二行包含 $n$ 个整数 $w_{i}$($1 \le w_{i} \le 10,000,000$),表示每根柱子的高度。你可以假设并非所有柱子的高度都相同。

输出格式

输出的第一行也是唯一一行应包含两个整数 $k$ 和 $m$,表示最多可以使用 $k$ 根柱子来建桥,且 $m$ 是在 $k$ 根柱子的前提下可取的最大的强度系数。你可以假设这样的 $m$ 一定存在。

样例

输入

6
7 4 10 8 7 1

输出

5 3
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.