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
( 19674 ) B Make it Zigzag PROGRAMMING constructive algorithms greedy

An arbitrary array of integers (b) of length (m) is considered awesome if for all (i) ((1 \le i < m)): if (i) is odd then (b_i < b_{i + 1}) holds. if (i) is even then (b_i > b_{i + 1}) holds. In other words, the following inequality is true: (b_1 < b_2 > b_3 < b_4 \ldots) You are given an array of positive integers (a) of length (n). You may do either of the following operations any number of times, in any order: operation (1): select an integer (i) ((1 \le i \le n)) and do: (a_i := \max(a_1,\ldots,a_i)), that is, replace (a_i) with the prefix max up to (i). operation (2): select an integer (i) ((1 \le i \le n)) and then decrease (a_i) by (1). Determine the minimum number of times you need to do operation (2) to make (a) awesome. Note that you do not need to minimise the number of times you perform operation (1). 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 an integer (n) ((2 \le n \le 2 \cdot 10^5)) — the length of the array (a). 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 sum of (n) across all test cases does not exceed (2 \cdot 10^5). For each testcase, output the minimum cost to make (a) awesome. In the first test case, the array is already awesome so no operations need to be done. In the second test case, (a) can be made awesome as follows: use operation (2) and decrease (a_1) by (1). (\color{red}3, 3, 2, 1 \rightarrow \color{red}2, 3, 2, 1). use operation (1) and change (a_4) to (\max(2, 3, 2, 1) = 3). (2, 3, 2, \color{red}1 \rightarrow 2, 3, 2, \color{red}3).

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
344763697 -NIKA-NIKA- B Oct. 19, 2025, 6:44 p.m. OK C# 13 TESTS 10 171 24883200
344772257 ksandr1v B Oct. 19, 2025, 7:52 p.m. OK C# 13 TESTS 10 186 3891200
344800141 shubham0310 B Oct. 20, 2025, 3:48 a.m. OK C++17 (GCC 7-32) TESTS 10 62 0
344794636 jakekim B Oct. 20, 2025, 2:31 a.m. OK C++17 (GCC 7-32) TESTS 10 62 1331200
344806169 jiangzhenxin B Oct. 20, 2025, 5:07 a.m. OK C++17 (GCC 7-32) TESTS 10 77 0
344805530 sambhrant_07 B Oct. 20, 2025, 5 a.m. OK C++17 (GCC 7-32) TESTS 10 77 0
344804867 TLENinja B Oct. 20, 2025, 4:53 a.m. OK C++17 (GCC 7-32) TESTS 10 77 0
344804773 SomilP B Oct. 20, 2025, 4:51 a.m. OK C++17 (GCC 7-32) TESTS 10 77 0
344804134 coderkrishna11 B Oct. 20, 2025, 4:43 a.m. OK C++17 (GCC 7-32) TESTS 10 77 0
344812311 hiten_upreti5 B Oct. 20, 2025, 6:07 a.m. OK C++17 (GCC 7-32) TESTS 10 77 0
344811862 painless_147 B Oct. 20, 2025, 6:03 a.m. OK C++17 (GCC 7-32) TESTS 10 77 0
344807786 ChosenPlant B Oct. 20, 2025, 5:24 a.m. OK C++17 (GCC 7-32) TESTS 10 77 0
344803132 saidpon B Oct. 20, 2025, 4:30 a.m. OK C++20 (GCC 13-64) TESTS 10 61 102400
344800305 shekharsuman0397 B Oct. 20, 2025, 3:50 a.m. OK C++20 (GCC 13-64) TESTS 10 61 3276800
344786613 nbwnd2010 B Oct. 19, 2025, 11:48 p.m. OK C++20 (GCC 13-64) TESTS 10 61 10035200
344759441 p_rathod B Oct. 19, 2025, 6:17 p.m. OK C++20 (GCC 13-64) TESTS 10 62 0
344789797 Shoeib B Oct. 20, 2025, 1:05 a.m. OK C++20 (GCC 13-64) TESTS 10 62 0
344784868 Shoeib B Oct. 19, 2025, 11:01 p.m. OK C++20 (GCC 13-64) TESTS 10 62 0
344771033 ScratchNSniff B Oct. 19, 2025, 7:41 p.m. OK C++20 (GCC 13-64) TESTS 10 62 0
344762518 mehdiCS B Oct. 19, 2025, 6:36 p.m. OK C++20 (GCC 13-64) TESTS 10 62 0
344807363 IanPardo B Oct. 20, 2025, 5:20 a.m. OK C++20 (GCC 13-64) TESTS 10 62 819200
344799036 JuanSoria B Oct. 20, 2025, 3:33 a.m. OK C++20 (GCC 13-64) TESTS 10 62 819200
344801759 AvoHado-_- B Oct. 20, 2025, 4:11 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 61 0
344787942 ZMU01 B Oct. 20, 2025, 12:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 61 0
344766721 mahirdll B Oct. 19, 2025, 7:06 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 61 0
344786680 piantouqu B Oct. 19, 2025, 11:51 p.m. OK C++23 (GCC 14-64, msys2) TESTS 10 61 1843200
344804070 big_shield B Oct. 20, 2025, 4:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 0
344810098 OkaTree71 B Oct. 20, 2025, 5:46 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 0
344808780 EdGrass B Oct. 20, 2025, 5:33 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 0
344808056 meetpatel177 B Oct. 20, 2025, 5:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 0
344806008 liiiiiilong B Oct. 20, 2025, 5:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 0
344802567 roni126 B Oct. 20, 2025, 4:22 a.m. OK C++23 (GCC 14-64, msys2) TESTS 10 62 0
344798267 Yassoor B Oct. 20, 2025, 3:23 a.m. OK C# 8 TESTS 10 155 16691200
344770983 Mysni B Oct. 19, 2025, 7:40 p.m. OK GNU C11 TESTS 10 108 921600
344784960 noobGODmax B Oct. 19, 2025, 11:03 p.m. OK GNU C11 TESTS 10 108 1740800
344764870 Blank_yoma B Oct. 19, 2025, 6:51 p.m. OK GNU C11 TESTS 10 109 1638400
344806218 jai314 B Oct. 20, 2025, 5:08 a.m. OK GNU C11 TESTS 10 124 921600
344759626 Papiba B Oct. 19, 2025, 6:18 p.m. OK GNU C11 TESTS 10 140 819200
344791605 uffhottie B Oct. 20, 2025, 1:40 a.m. OK Go TESTS 10 62 3993600
344791790 h_maano B Oct. 20, 2025, 1:44 a.m. OK Java 21 TESTS 10 280 614400
344793280 GuLLu05 B Oct. 20, 2025, 2:10 a.m. OK Java 21 TESTS 10 296 409600
344787100 chpkrishnamohan B Oct. 20, 2025, 12:04 a.m. OK Java 21 TESTS 10 296 614400
344795075 Baaabin B Oct. 20, 2025, 2:37 a.m. OK Java 21 TESTS 10 296 1024000
344806157 __Aviral__ B Oct. 20, 2025, 5:07 a.m. OK Java 21 TESTS 10 312 819200
344776220 tekka_ity B Oct. 19, 2025, 8:35 p.m. OK Java 21 TESTS 10 312 819200
344797903 jagger040924 B Oct. 20, 2025, 3:18 a.m. OK Java 21 TESTS 10 327 921600
344805927 ojasrawat2072 B Oct. 20, 2025, 5:05 a.m. OK Java 21 TESTS 10 327 1536000
344765624 Goutham_808 B Oct. 19, 2025, 6:57 p.m. OK Java 21 TESTS 10 343 614400
344809490 divyanshnm B Oct. 20, 2025, 5:40 a.m. OK Java 21 TESTS 10 343 1024000
344790775 suntansoker B Oct. 20, 2025, 1:24 a.m. OK Java 8 TESTS 10 187 3481600
344765568 sarthaKKharKa_18 B Oct. 19, 2025, 6:56 p.m. OK Java 8 TESTS 10 217 3481600
344745462 subha_ray B Oct. 19, 2025, 4:34 p.m. OK Java 8 TESTS 10 437 0
344745355 mayank_112 B Oct. 19, 2025, 4:34 p.m. OK Java 8 TESTS 10 453 0
344751034 ez_coder B Oct. 19, 2025, 5:34 p.m. OK Java 8 TESTS 10 468 0
344752010 Eslam_Ahmed B Oct. 19, 2025, 5:39 p.m. OK Java 8 TESTS 10 499 21913600
344806507 snehil2999 B Oct. 20, 2025, 5:11 a.m. OK Kotlin 2.2 TESTS 10 156 0
344786509 swseverance B Oct. 19, 2025, 11:45 p.m. OK Node.js TESTS 10 265 60620800
344789005 Biggaypig B Oct. 20, 2025, 12:49 a.m. OK PyPy 3 TESTS 10 374 18329600
344797298 vahrohit B Oct. 20, 2025, 3:09 a.m. OK PyPy 3 TESTS 10 374 18432000
344765136 dakshagarwaliitd B Oct. 19, 2025, 6:53 p.m. OK PyPy 3 TESTS 10 452 17715200
344784333 maurine26 B Oct. 19, 2025, 10:47 p.m. OK PyPy 3-64 TESTS 10 140 20684800
344784745 noobGODmax B Oct. 19, 2025, 10:57 p.m. OK PyPy 3-64 TESTS 10 140 24268800
344755026 jigitmax B Oct. 19, 2025, 5:53 p.m. OK PyPy 3-64 TESTS 10 140 27648000
344784622 noobGODmax B Oct. 19, 2025, 10:54 p.m. OK PyPy 3-64 TESTS 10 155 23040000
344784268 noobGODmax B Oct. 19, 2025, 10:46 p.m. OK PyPy 3-64 TESTS 10 155 26828800
344768090 gardengnome B Oct. 19, 2025, 7:16 p.m. OK PyPy 3-64 TESTS 10 155 26931200
344801419 itsme_uk B Oct. 20, 2025, 4:06 a.m. OK PyPy 3-64 TESTS 10 155 27033600
344772955 Akiii_2023 B Oct. 19, 2025, 7:59 p.m. OK PyPy 3-64 TESTS 10 155 27136000
344776504 ezooooo5.rappelz B Oct. 19, 2025, 8:39 p.m. OK PyPy 3-64 TESTS 10 155 28262400
344785778 alexwice B Oct. 19, 2025, 11:25 p.m. OK PyPy 3-64 TESTS 10 171 24678400
344801217 Satya2605 B Oct. 20, 2025, 4:03 a.m. OK Python 2 TESTS 10 265 9932800
344759583 SteveCoder B Oct. 19, 2025, 6:18 p.m. OK Python 3 TESTS 10 155 26624000
344761457 demonicc B Oct. 19, 2025, 6:29 p.m. OK Python 3 TESTS 10 171 25395200
344788354 lovmilkdragon B Oct. 20, 2025, 12:33 a.m. OK Python 3 TESTS 10 171 26624000
344783822 noobGODmax B Oct. 19, 2025, 10:35 p.m. OK Python 3 TESTS 10 171 26624000
344784190 noobGODmax B Oct. 19, 2025, 10:44 p.m. OK Python 3 TESTS 10 171 26726400
344784563 noobGODmax B Oct. 19, 2025, 10:53 p.m. OK Python 3 TESTS 10 187 20480000
344803306 kavya8 B Oct. 20, 2025, 4:32 a.m. OK Python 3 TESTS 10 187 26726400
344751972 gokulnotre5 B Oct. 19, 2025, 5:38 p.m. OK Python 3 TESTS 10 187 26828800
344752624 eugalt B Oct. 19, 2025, 5:41 p.m. OK Python 3 TESTS 10 187 28569600
344812266 Dhruthi_MS B Oct. 20, 2025, 6:07 a.m. OK Python 3 TESTS 10 187 28672000

remove filters

Back to search problems