QOJ.ac

QOJ

時間限制: 1 s 記憶體限制: 256 MB 總分: 100

#4490. 乘2除2的Hack

统计

说明:本题与题目 Multiply 2 Divide 2 之间没有依赖关系。

Frank_DD 有一个长度为 $n$ 的序列 $a$ ($1 \le n \le 10^5, 1 \le a_i \le 10^5$)。 对于每次操作,他可以选择一个数 $a_i$ ($1 \le i \le n$) 并将其变为 $a_i \cdot 2$ 或 $\lfloor \frac{a_i}{2} \rfloor$。 Frank_DD 想要知道将序列 $a$ 变为非降序列所需的最少操作次数。 为了帮助 Frank_DD 解决这个问题,ddy 猜测结果序列中的数字不会很大,且不会超过 $2^{127} - 1$,这意味着结果序列中的每个数字都可以用 128 位有符号整数变量存储。 形式化地,他猜测对于每个满足约束条件的序列 $a$,总存在一种操作次数最少的方式,使得结果序列中 $a_n < 2^{127}$。 因此,他编写了一个基于此想法的程序。 但不幸的是,这个想法是错误的,所以这个程序可以被 hack。 现在你需要构造一个序列来 hack ddy 的程序。当且仅当你的序列满足约束条件,且 ddy 的想法对于该序列是错误的时,你的解法才被认为是正确的。

输入格式

本题没有输入。

输出格式

第一行包含一个整数 $n$ ($1 \le n \le 10^5$) —— 序列 $a$ 的长度。 第二行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^5$) —— 序列 $a$。

说明

例如,如果你的输出是 7 6 3 3 4 10 8 2

我们可以使用至少 4 次操作将序列 $a$ 变为非降序列: $a_1 = \lfloor \frac{a_1}{2} \rfloor$ $a_5 = \lfloor \frac{a_5}{2} \rfloor$ $a_7 = a_7 \cdot 2$ $a_7 = a_7 \cdot 2$

这样,在结果序列中,$a_n = 8 < 2^{127}$。因此你会得到错误答案。

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.