当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

7198:Hack of Multiply 2 Divide 2

Special Judge 特殊评判
题目描述
$\textbf{Note:There is no dependency between this problem and problem Multiply 2 Divide 2.}$

Frank_DD has a sequence $a$ of length $n(1 \leq n \leq 10^5,1 \leq a_i \leq 10^5)$.

For each operation, he selects a number $a_i(1 \le i \le n)$ and changes it to $a_i\cdot 2$ or $\lfloor \frac{a_i}{2} \rfloor$.

Frank_DD wants to know the minimum number of operations to change the sequence $a$ to a non-descending sequence.

To help Frank_DD solve this problem, ddy guesses that the number in the result sequence can't be very large, and it will not exceed $2^{127}-1$, which means that every number in the result sequence can be held in a 128-bit signed integer variable.

Formally, he guesses that for each sequence $a$ that satisfies the constraints, there will always be a way that the number of operations is minimal, and in the result sequence, $a_n<2^{127}$.

So, he writes a program relying on this idea.

But unfortunately, the idea is wrong, so this program can be hacked.

Now you should construct a sequence to hack the program of ddy. Your solution is considered correct if and only if this sequence satisfies the constraints, and the idea of ddy is wrong to this sequence.
输入解释
This problem has no input.
输出解释
The first line contains a single integer $n(1 \leq n \leq 10^5)$ --- the length of sequence $a$.

The second line contains $n$ integers $a_1, a_2, \ldots, a_n$ $(1 \leq a_i \leq 10^5)$ --- the sequence $a$.
输入样例
This problem has no input.
输出样例
7
6 3 3 4 10 8 2
来自杭电HDUOJ的附加信息
Hint For example, if your output is 76 3 3 4 10 8 2We can use at least $4$ operations to change the sequence $a$ to a non-descending sequence:$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$In this way, in the result sequence, $a_n=8<2^{127}$. So you will get wrong answer.

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-7198

最后修改于 2022-09-15T06:17:18+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 524288/262144K(Java/Others)