Codeforces Round 1023 (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
2107 Codeforces Round 1023 (Div. 2) FINISHED False 8100 29949923 May 5, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1810 ) F1 Cycling (Easy Version) PROGRAMMING dp greedy

This is the easy version of the problem. The difference between the versions is that in this version, (1\le n\le 5\cdot 10^3) and you don't need to output the answer for each prefix. You can hack only if you solved all versions of this problem. Leo works as a programmer in the city center, and his lover teaches at a high school in the suburbs. Every weekend, Leo would ride his bike to the suburbs to spend a nice weekend with his lover. There are (n) cyclists riding in front of Leo on this road right now. They are numbered (1), (2), (\ldots), (n) from front to back. Initially, Leo is behind the (n)-th cyclist. The (i)-th cyclist has an agility value (a_i). Leo wants to get ahead of the (1)-st cyclist. Leo can take the following actions as many times as he wants: Assuming that the first person in front of Leo is cyclist (i), he can go in front of cyclist (i) for a cost of (a_i). This puts him behind cyclist (i - 1). Using his super powers, swap (a_i) and (a_j) ((1\le i < j\le n)) for a cost of ((j - i)). Leo wants to know the minimum cost to get in front of the (1)-st cyclist. Here you only need to print the answer for the whole array, i.e. (a_1, a_2, \ldots, a_n). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^3)). The description of the test cases follows. The first line of each test case contains a positive integer (n) ((1 \leq n \leq 5\cdot 10^3)), representing the number of the cyclists. The second line of each test case contains (n) integers (a_1, \ldots, a_n) ((1 \leq a_i \leq 10^9)). It is guaranteed that the sum of (n) over all test cases does not exceed (5\cdot 10^3). For each test case, print one integer representing the minimum cost for Leo to go from behind the (n)-th cyclist to in front of the (1)-st cyclist. In the first test case, one possible way to move f

Tutorials

Codeforces Round 1023 (Div 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
318569619 pkhaustov F1 May 6, 2025, 1:39 a.m. OK C++17 (GCC 7-32) TESTS 33 46 102400
318540742 moulayou F1 May 5, 2025, 5:58 p.m. OK C++17 (GCC 7-32) TESTS 33 46 3686400
318546134 Hemal F1 May 5, 2025, 6:52 p.m. OK C++17 (GCC 7-32) TESTS 33 61 102400
318569397 tfgs F1 May 6, 2025, 1:33 a.m. OK C++17 (GCC 7-32) TESTS 33 62 102400
318543346 Nxxlt F1 May 5, 2025, 6:23 p.m. OK C++17 (GCC 7-32) TESTS 33 62 102400
318520693 gradnos F1 May 5, 2025, 4:28 p.m. OK C++17 (GCC 7-32) TESTS 33 62 102400
318540941 dmraykhan F1 May 5, 2025, 6 p.m. OK C++17 (GCC 7-32) TESTS 33 77 102400
318524235 ywjylx F1 May 5, 2025, 4:38 p.m. OK C++17 (GCC 7-32) TESTS 33 77 102400
318542498 AlefHeKaaf F1 May 5, 2025, 6:14 p.m. OK C++17 (GCC 7-32) TESTS 33 77 7270400
318576731 Gaomer123 F1 May 6, 2025, 4:01 a.m. OK C++17 (GCC 7-32) TESTS 33 93 102400
318572423 mathiasgw F1 May 6, 2025, 2:41 a.m. OK C++20 (GCC 13-64) TESTS 33 61 102400
318550500 turkhuu622 F1 May 5, 2025, 7:47 p.m. OK C++20 (GCC 13-64) TESTS 33 61 102400
318581265 dinosaur7 F1 May 6, 2025, 5:17 a.m. OK C++20 (GCC 13-64) TESTS 33 62 102400
318579908 Fantasy_Blue F1 May 6, 2025, 4:58 a.m. OK C++20 (GCC 13-64) TESTS 33 62 102400
318576421 fishcathu F1 May 6, 2025, 3:56 a.m. OK C++20 (GCC 13-64) TESTS 33 62 102400
318557271 shinigami11 F1 May 5, 2025, 9:49 p.m. OK C++20 (GCC 13-64) TESTS 33 62 102400
318550670 parag776 F1 May 5, 2025, 7:50 p.m. OK C++20 (GCC 13-64) TESTS 33 62 102400
318549920 Clan328 F1 May 5, 2025, 7:38 p.m. OK C++20 (GCC 13-64) TESTS 33 62 102400
318546637 tourust F1 May 5, 2025, 6:57 p.m. OK C++20 (GCC 13-64) TESTS 33 62 102400
318541462 Carucao F1 May 5, 2025, 6:05 p.m. OK C++20 (GCC 13-64) TESTS 33 62 102400
318583135 424479543 F1 May 6, 2025, 5:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 46 102400
318574887 DanielChang F1 May 6, 2025, 3:28 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 46 102400
318577364 sleepntsheep F1 May 6, 2025, 4:13 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 61 24064000
318570268 Yue_chen F1 May 6, 2025, 1:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 62 0
318568905 A_G F1 May 6, 2025, 1:22 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 62 0
318560742 _Sherbiny F1 May 5, 2025, 11:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 33 62 0
318583039 424479543 F1 May 6, 2025, 5:41 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 62 102400
318577656 pizza53 F1 May 6, 2025, 4:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 62 102400
318574675 Rating_10101010 F1 May 6, 2025, 3:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 62 102400
318574474 Zzzzqwq F1 May 6, 2025, 3:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 33 62 102400
318537495 muradbhai F1 May 5, 2025, 5:34 p.m. OK GNU C11 TESTS 33 77 204800
318524489 METASEKOIA F1 May 5, 2025, 4:39 p.m. OK Go TESTS 33 109 307200
318548383 beedle F1 May 5, 2025, 7:18 p.m. OK Java 21 TESTS 33 656 262963200
318575790 ccj123 F1 May 6, 2025, 3:45 a.m. OK Java 21 TESTS 33 749 262246400
318525595 husc24.Serge_ F1 May 5, 2025, 4:42 p.m. OK Kotlin 1.7 TESTS 33 1109 268390400
318559853 Badint F1 May 5, 2025, 11:14 p.m. OK Kotlin 1.9 TESTS 33 296 409600
318536398 nwblanton F1 May 5, 2025, 5:28 p.m. OK PyPy 3-64 TESTS 33 156 4198400
318543846 Limitless09 F1 May 5, 2025, 6:28 p.m. OK PyPy 3-64 TESTS 33 218 5120000
318526689 tapris06 F1 May 5, 2025, 4:45 p.m. OK PyPy 3-64 TESTS 33 218 5120000
318553714 georkings F1 May 5, 2025, 8:38 p.m. OK PyPy 3-64 TESTS 33 234 8499200
318576696 esrever F1 May 6, 2025, 4:01 a.m. OK Rust 2021 TESTS 33 78 102400

remove filters

Back to search problems