Codeforces Global Round 31 (Div. 1 + 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
2180 Codeforces Global Round 31 (Div. 1 + Div. 2) FINISHED False 9000 10250722 Dec. 19, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 132 ) G Balance PROGRAMMING combinatorics math

You have an array (a) which is initially empty. You have to process (q) queries of the following types on your array. Type 1 : Erase the middle element of (a). Formally, if (a) has (n) elements, remove the (\lceil \frac{n}{2} \rceil)-th(^{\text{∗}}) element of (a) and concatenate the remaining parts. It's guaranteed that (a) is non-empty whenever you are given a query of this type. Type 2 : Insert (x) at the beginning, the end, and between every two consecutive elements of (a). Formally, if (a = a_1, a_2, \ldots, a_n) before this query, (a) will become (x, a_1, x, a_2, x, \ldots, x, a_n, x) after the query. Type 3 : Output the sum of the balances of all (2^L - 1) non-empty subsequences(^{\text{†}}) of (a), where (L) is the length of (a) at this moment. It is guaranteed that (L) will not be a multiple of (10^9 + 7) whenever this query is processed. The balance of an array (b = b_1, b_2, \ldots, b_m) is defined as () \text{balance}(b) = \frac{1 \cdot b_1 + 2 \cdot b_2 + \ldots + m \cdot b_m}{m}. () (^{\text{∗}})(\lceil k \rceil) is the (k) rounded up, i. e. the smallest integer greater than or equal to (k). (^{\text{†}})A sequence (b) is a subsequence of a sequence (a) if (b) can be obtained from (a) by the deletion of several (possibly, zero or all) element from arbitrary positions. Two subsequences are considered different if the sets of positions of the deleted elements are different. 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 (q) ((2 \leq q \leq 10^6)), denoting the number of queries. The next (q) lines describe the queries: Each query of type 1 is in the form 1 , which means to erase the middle element of (a). It's guarante

Tutorials

Codeforces Global Round 31

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
354230834 luoxueac G Dec. 19, 2025, 7:01 p.m. OK C++17 (GCC 7-32) TESTS 44 1312 9011200
354252016 liujiaxi123456 G Dec. 20, 2025, 2:45 a.m. OK C++20 (GCC 13-64) TESTS 45 234 6246400
354254075 Mango2011 G Dec. 20, 2025, 3:24 a.m. OK C++20 (GCC 13-64) TESTS 45 453 22425600
354247761 qiuzx G Dec. 20, 2025, 12:57 a.m. OK C++20 (GCC 13-64) TESTS 45 1812 142540800
354217231 qiuzx G Dec. 19, 2025, 5:04 p.m. OK C++20 (GCC 13-64) TESTS 43 1906 142540800

remove filters

Back to search problems