Codeforces Round 1060 (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
2154 Codeforces Round 1060 (Div. 2) FINISHED False 7200 15521123 Oct. 19, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1195 ) E No Mind To Think PROGRAMMING binary search greedy sortings ternary search two pointers

You are given an array of positive integers (a) of length (n) and a positive integer (k), and you will play the following game with them: At the start of the game, you will choose an odd integer (x) ((1 \le x \le n)). Then do the following at most (k) times (possibly none): Select a subsequence of (a) of length (x), then replace every value in the subsequence with the median(^{\text{∗}}) of that subsequence. More formally, pick (x) integers (i_1,\ldots,i_x) ((1 \le i_1 < i_2 < \ldots < i_x \le n)). Then simultaneously do (a_{i_d}):= (\mathrm{median}(a_{i_1},a_{i_2},\ldots,a_{i_x})) for all (d) ((1 \le d \le x)). Select a subsequence of (a) of length (x), then replace every value in the subsequence with the median(^{\text{∗}}) of that subsequence. More formally, pick (x) integers (i_1,\ldots,i_x) ((1 \le i_1 < i_2 < \ldots < i_x \le n)). Then simultaneously do (a_{i_d}):= (\mathrm{median}(a_{i_1},a_{i_2},\ldots,a_{i_x})) for all (d) ((1 \le d \le x)). Note that the integer (x) you choose cannot change between operations. Determine the maximum value for the sum of (a) obtainable after playing the game. (^{\text{∗}})The median of an array (a) of length (n) (written (\mathrm{median}(a))) is the (\left\lfloor\frac{n + 1}{2}\right\rfloor)-th smallest element in (a), where (\left\lfloor x \right\rfloor) denotes the largest integer which is smaller than or equal to (x). For example, (\mathrm{median}(4, 3, 1, 2, 5) = 3) and (\mathrm{median}(4, 3, 5, 3) = 3). 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 integers (n) and (k) ((3 \le n \le 2 \cdot 10^5), (1 \le k \le 2 \cdot 10^5)) — the length of the array (a), and the maximum num

Tutorials

Codeforces Round 1060 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
344800415 BiaxialRay_ E Oct. 20, 2025, 3:52 a.m. OK C++17 (GCC 7-32) TESTS 35 109 3276800
344807264 gevak E Oct. 20, 2025, 5:19 a.m. OK C++17 (GCC 7-32) TESTS 35 140 12083200
344782042 znfifuncduqjklvmx E Oct. 19, 2025, 9:59 p.m. OK C++17 (GCC 7-32) TESTS 35 155 3276800
344807432 paras_m E Oct. 20, 2025, 5:21 a.m. OK C++17 (GCC 7-32) TESTS 35 156 0
344768108 cemil1234 E Oct. 19, 2025, 7:17 p.m. OK C++17 (GCC 7-32) TESTS 34 156 102400
344804780 gevak E Oct. 20, 2025, 4:51 a.m. OK C++17 (GCC 7-32) TESTS 35 156 12083200
344750135 kylin0610 E Oct. 19, 2025, 5:31 p.m. OK C++17 (GCC 7-32) TESTS 34 171 0
344772300 richardl02 E Oct. 19, 2025, 7:53 p.m. OK C++17 (GCC 7-32) TESTS 34 171 2764800
344760832 adhoc_is_garbage E Oct. 19, 2025, 6:26 p.m. OK C++17 (GCC 7-32) TESTS 34 186 0
344772429 Rudra_1232 E Oct. 19, 2025, 7:54 p.m. OK C++17 (GCC 7-32) TESTS 34 187 102400
344798005 Donaldqian0712 E Oct. 20, 2025, 3:19 a.m. OK C++20 (GCC 13-64) TESTS 35 92 2560000
344799020 nbwnd2010 E Oct. 20, 2025, 3:33 a.m. OK C++20 (GCC 13-64) TESTS 35 93 18124800
344785738 ammar2000 E Oct. 19, 2025, 11:23 p.m. OK C++20 (GCC 13-64) TESTS 35 108 0
344803183 gevak E Oct. 20, 2025, 4:30 a.m. OK C++20 (GCC 13-64) TESTS 35 108 12083200
344782207 fugazi_zeitgeist E Oct. 19, 2025, 10:01 p.m. OK C++20 (GCC 13-64) TESTS 35 109 102400
344800951 Ghulam_Junaid E Oct. 20, 2025, 3:59 a.m. OK C++20 (GCC 13-64) TESTS 35 109 3276800
344777251 goulthen E Oct. 19, 2025, 8:48 p.m. OK C++20 (GCC 13-64) TESTS 35 109 3276800
344803620 gevak E Oct. 20, 2025, 4:36 a.m. OK C++20 (GCC 13-64) TESTS 35 109 12083200
344777654 TheSahib E Oct. 19, 2025, 8:53 p.m. OK C++20 (GCC 13-64) TESTS 35 124 0
344810918 Adilkhan855 E Oct. 20, 2025, 5:54 a.m. OK C++20 (GCC 13-64) TESTS 35 124 102400
344791376 zyn1919810 E Oct. 20, 2025, 1:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 77 3379200
344799041 piantouqu E Oct. 20, 2025, 3:33 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 77 3481600
344797203 LittleFoxFairy E Oct. 20, 2025, 3:08 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 78 3481600
344800205 BiaxialRay_ E Oct. 20, 2025, 3:49 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 93 3276800
344799079 khoand25112007 E Oct. 20, 2025, 3:34 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 93 6451200
344754346 byte-the-bit E Oct. 19, 2025, 5:50 p.m. OK C++23 (GCC 14-64, msys2) TESTS 34 108 0
344805575 Ryazimn E Oct. 20, 2025, 5:01 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 108 3276800
344791467 lyh3.14 E Oct. 20, 2025, 1:38 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 108 3276800
344798482 BiaxialRay_ E Oct. 20, 2025, 3:26 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 108 6553600
344808141 L2ngg E Oct. 20, 2025, 5:28 a.m. OK C++23 (GCC 14-64, msys2) TESTS 35 109 0
344792336 1091857051 E Oct. 20, 2025, 1:54 a.m. OK Java 21 TESTS 35 437 1228800
344784238 gardengnome E Oct. 19, 2025, 10:45 p.m. OK PyPy 3-64 TESTS 35 327 28467200
344779043 Maverick027 E Oct. 19, 2025, 9:11 p.m. OK Rust 2024 TESTS 35 108 2457600

remove filters

Back to search problems