Codeforces Round 1049 (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
2140 Codeforces Round 1049 (Div. 2) FINISHED False 7200 18977123 Sept. 9, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 306 ) F Sum Minimisation PROGRAMMING number theory

You are given an array (a) of size (n), and you can perform the following operation on the array (a) any number of times (including zero): Select any set of (k) distinct indices (S = \{i_1, i_2, \ldots, i_k\}), where (1 \le i_j \le n) for all (1\le j\le k). Compute the sum (x = a_{i_1} + a_{i_2} + \cdots + a_{i_k}), and set (y = x - \left\lfloor \frac{x}{k} \right\rfloor \cdot k). Among the selected elements (a_{i_1}, \ldots, a_{i_k}), decrease the (y) smallest values by (1). If two elements have different values ((a_i\ne a_j)), the one with the smaller value is smaller. If two elements have the same value ((a_i= a_j)), the one with the smaller index is smaller. If (y=0), no element is decreased. If two elements have different values ((a_i\ne a_j)), the one with the smaller value is smaller. If two elements have the same value ((a_i= a_j)), the one with the smaller index is smaller. If (y=0), no element is decreased. Your task is to determine the minimum possible value of the sum of elements of the array (a) that can be achieved after performing the operation any number of times or report that it can be decreased indefinitely. 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 testcase contains a single integer (n) ((1 \le n \le 10^6)) — the length of the array (a). The second line of each testcase contains (n) integers (a_1,a_2,a_3,\ldots,a_n) ((1 \le a_i \le 10^9)) — the elements of the array (a). It is guaranteed that the sum of (n) over all test cases does not exceed (10^6). For each testcase, print the minimum possible value of the sum of elements of the array (a) that can be achieved after performing the above mentioned operation any number of times. If the sum of elements of the array (a) can be

Tutorials

Codeforces Round 1049 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
337856062 VaHiX F Sept. 9, 2025, 5:41 p.m. OK C++17 (GCC 7-32) TESTS 38 389 9216000
337856195 QAQ_QWQ F Sept. 9, 2025, 5:42 p.m. OK C++17 (GCC 7-32) TESTS 38 436 4096000
337844914 StarSilk F Sept. 9, 2025, 4:29 p.m. OK C++20 (GCC 13-64) TESTS 38 218 8089600
337892626 xujindong F Sept. 10, 2025, 3:27 a.m. OK C++20 (GCC 13-64) TESTS 38 249 4096000
337891797 xujindong F Sept. 10, 2025, 3:14 a.m. OK C++20 (GCC 13-64) TESTS 38 250 4096000
337882483 Leo_W F Sept. 10, 2025, 12:14 a.m. OK C++20 (GCC 13-64) TESTS 38 264 5120000
337851228 gortomi F Sept. 9, 2025, 5:07 p.m. OK C++20 (GCC 13-64) TESTS 38 265 4198400
337850397 RGB_ICPC8 F Sept. 9, 2025, 5:03 p.m. OK C++20 (GCC 13-64) TESTS 38 280 4198400
337838617 BurnedChicken F Sept. 9, 2025, 4:15 p.m. OK C++20 (GCC 13-64) TESTS 38 281 4198400
337903805 jrjyy F Sept. 10, 2025, 5:57 a.m. OK C++20 (GCC 13-64) TESTS 38 296 4096000
337903474 jrjyy F Sept. 10, 2025, 5:54 a.m. OK C++20 (GCC 13-64) TESTS 38 296 4198400
337884551 Announcement F Sept. 10, 2025, 1:03 a.m. OK C++20 (GCC 13-64) TESTS 38 311 12185600
337880632 Auchenai01 F Sept. 9, 2025, 11:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 38 202 204800
337885346 shendeliliang F Sept. 10, 2025, 1:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 38 250 16076800
337885863 A_G F Sept. 10, 2025, 1:30 a.m. OK C++23 (GCC 14-64, msys2) TESTS 38 265 204800
337877241 kaiboy F Sept. 9, 2025, 10:20 p.m. OK C++23 (GCC 14-64, msys2) TESTS 38 280 4096000
337848238 Raiden_Bosenmori_Mei F Sept. 9, 2025, 4:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 38 280 4096000
337885283 shendeliliang F Sept. 10, 2025, 1:19 a.m. OK C++23 (GCC 14-64, msys2) TESTS 38 280 16076800
337842422 tosivanmak F Sept. 9, 2025, 4:23 p.m. OK C++23 (GCC 14-64, msys2) TESTS 38 281 17920000
337853376 tfg F Sept. 9, 2025, 5:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 38 296 4300800
337885823 shendeliliang F Sept. 10, 2025, 1:29 a.m. OK C++23 (GCC 14-64, msys2) TESTS 38 312 16076800
337867161 DevilWizard69 F Sept. 9, 2025, 7:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 38 327 204800
337850293 Anichesschamp1008 F Sept. 9, 2025, 5:03 p.m. OK Java 21 TESTS 38 1421 44236800
337877065 ikrpprppp F Sept. 9, 2025, 10:16 p.m. OK Kotlin 2.2 TESTS 38 1749 122675200
337851932 zouyu9631 F Sept. 9, 2025, 5:12 p.m. OK PyPy 3 TESTS 38 1578 74137600
337891724 Little_Sheep_Yawn F Sept. 10, 2025, 3:13 a.m. OK PyPy 3-64 TESTS 38 421 135987200
337862846 MDelPiero F Sept. 9, 2025, 6:40 p.m. OK Python 3 TESTS 38 655 104243200

remove filters

Back to search problems