F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Hack of Multiply 2 Divide 2

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/262144 K (Java/Others)
Total Submission(s): 153    Accepted Submission(s): 33
Special Judge


Problem Description
$\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.
 

Input
This problem has no input.
 

Output
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$.
 

Sample Input
This problem has no input.
 

Sample Output
7 6 3 3 4 10 8 2
 

Hint

For example, if your output is

7

6 3 3 4 10 8 2

We 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.
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-05-17 22:25:32, Gzip enabled