Codeforces Round 1099 (Div. 2)

Solutions are presented as using the least memory and the fastest execution time. It also takes the top 10 most recent solutions from each language. If you want to limit to a specific index, click the "Solved" button and go to that problem.

ContestId
Name
Phase
Frozen
Duration (Seconds)
Relative Time
Start Time
2231 Codeforces Round 1099 (Div. 2) FINISHED False 7200 2129080 May 21, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 10558 ) C Chipmunk Theo and Equality PROGRAMMING implementation

While exploring the depths of the Internet, Theodore the chipmunk found a very interesting sequence of positive integers and decided to play with it. In one operation, he chooses an element of the sequence and performs the following action: If the chosen element is even, he divides it by 2. If the chosen element is odd, he increases it by 1. Theo really loves equality, so he wants to make all numbers in the sequence equal (otherwise, some numbers might feel offended). Since he needs to plan his lunch time, help him determine the minimum number of operations required to make all numbers equal. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((1 \le n \le 10^5)) — the length of the sequence. The second line of each test case contains (n) integers (a_1, a_2, \ldots, a_n) ((1 \le a_i \le 10^9)) — the elements of the sequence. It is guaranteed that the sum of (n) over all test cases does not exceed (10^5). For each test case, output a single integer — the minimum number of operations Theo needs to make all numbers in the sequence equal. In the first test case, we have a sequence: (3, 2, 4) One possible sequence of operations: () \textbf{3}, 2, 4 \rightarrow \textbf{4}, 2, 4 \rightarrow 2, 2, \textbf{4} \rightarrow 2, 2, 2 () (Operations are performed on numbers shown in bold.) In the second test case, the sequence is: (3, 6, 7, 16, 8, 8, 7) Possible operations: Perform the operation once on the 1st element: (3 \rightarrow 4) Perform the operation twice on the 2nd element: (6 \rightarrow 3 \rightarrow 4) Perform the operation twice on the 4th element: (7 \rightarrow 8 \rightarrow 4) Perform the operation twice on the 5th element: (16 \rightarrow 8 \rightarrow 4) Perform the operation once on the 6th element: $$$8

Tutorials

Submissions

No solutions yet.