QOJ.ac

QOJ

حد الوقت: 1.0 s حد الذاكرة: 256 MB مجموع النقاط: 100 قابلة للهجوم ✓

#8210. Division 3 多语言者

الإحصائيات

1 Problem X: Karina and Array

Karina 有一个包含 $n$ 个整数的数组 $a_1, a_2, a_3, \dots, a_n$。她喜欢乘法,因此她认为一对数字的“美感”就是它们的乘积。而一个数组的“美感”定义为该数组中相邻元素对的最大美感。

例如,对于 $n = 4, a = [3, 5, 7, 4]$,该数组的美感为 $\max(3 \cdot 5, 5 \cdot 7, 7 \cdot 4) = \max(15, 35, 28) = 35$。

Karina 希望她的数组尽可能美。为了实现这一目标,她可以从数组中删除一些元素(可以为零个)。在 Karina 删除她想要删除的所有元素后,数组必须至少包含两个元素。

不幸的是,Karina 没有足够的时间来完成所有任务,所以她请你计算通过删除任意数量的元素(可能为零)后,她能得到的数组的最大美感。

输入格式

第一行包含一个整数 $t$ ($1 \le t \le 10^4$) —— 测试用例的数量。

接下来是测试用例的描述。

对于每个测试用例: 第一行包含一个整数 $n$ ($2 \le n \le 2 \times 10^5$) —— 数组 $a$ 的长度。 第二行包含 $n$ 个整数 $a_1, a_2, a_3, \dots, a_n$ ($-10^9 \le a_i \le 10^9$) —— 数组 $a$ 的元素。

所有测试用例的 $n$ 之和不超过 $2 \times 10^5$。

输出格式

输出 $t$ 个整数,每个整数对应相应测试用例的答案 —— Karina 能得到的数组的最大美感。

2 Problem Y: Boats Competition

有 $n$ 个人想要参加划船比赛。第 $i$ 个参与者的体重为 $w_i$。只有由两人组成的队伍才能参加比赛。作为组织者,你认为只允许总重量相同的队伍参赛是公平的。

因此,如果有 $k$ 个队伍 $(a_1, b_1), (a_2, b_2), \dots, (a_k, b_k)$,其中 $a_i$ 是第 $i$ 个队伍中第一个人的体重,$b_i$ 是第 $i$ 个队伍中第二个人的体重,那么必须满足条件 $a_1 + b_1 = a_2 + b_2 = \dots = a_k + b_k = s$,其中 $s$ 是每个队伍的总重量。

你的任务是选择一个 $s$,使得人们可以组成的队伍数量尽可能多。注意,每个参与者最多只能参加一个队伍。

输入格式

第一行包含一个整数 $t$ ($1 \le t \le 1000$) —— 测试用例的数量。接下来是 $t$ 个测试用例。

对于每个测试用例: 第一行包含一个整数 $n$ ($1 \le n \le 50$) —— 参与者人数。 第二行包含 $n$ 个整数 $w_1, w_2, \dots, w_n$ ($1 \le w_i \le n$),其中 $w_i$ 是第 $i$ 个参与者的体重。

输出格式

对于每个测试用例,输出一个整数 $k$:如果你最优地选择 $s$,人们可以组成的队伍的最大数量。

3 Actual Problem

现在,给定一个整数 $x$,你的任务是构造一个测试用例,该测试用例对上述两个问题均有效,并且使得这两个问题的正确解输出均为单个整数 $x$。

输入格式

第一行且仅有一行包含一个整数 $x$ ($1 \le x \le 25$) —— 正确解所期望的输出。

输出格式

分多行输出一个有效的测试用例。该测试用例必须是上述两个 CodeForces 问题的有效输入,且对于任一问题的正确解都应输出一行包含整数 $x$ 的结果。

样例

样例输入 1

6

样例输出 1

1
14
2 1 2 3 1 2 1 1 2 1 2 2 1 2

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.