Codeforces Round 876 (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
1839 Codeforces Round 876 (Div. 2) FINISHED False 7200 51377063 June 3, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 2405 ) D Ball Sorting PROGRAMMING data structures dp sortings

B"There are n colorful balls arranged in a row. The balls are painted in n distinct colors, denoted by numbers from 1 to n . The i -th ball from the left is painted in color c_i . You want to reorder the balls so that the i -th ball from the left has color i . Additionally, you have k ge 1 balls of color 0 that you can use in the reordering process. Due to the strange properties of the balls, they can be reordered only by performing the following operations: You can perform these operations in any order. After the last operation, all balls of color 0 magically disappear, leaving a sequence of n balls of non-zero colors. What is the minimum amount of coins you should spend on the operations of the second type, so that the i -th ball from the left has color i for all i from 1 to n after the disappearance of all balls of color zero? It can be shown that under the constraints of the problem, it is always possible to reorder the balls in the required way. Solve the problem for all k from 1 to n . The first line contains integer t ( 1 <= t <= 500 ) -- the number of test cases. The descriptions of the test cases follow. The first line contains one integer n ( 1 <= n <= 500 ) -- the number of balls. The second line contains n distinct integers c_1, c_2, ldots, c_n ( 1 <= c_i <= n ) -- the colors of balls from left to right. It is guaranteed that sum of n over all test cases doesn't exceed 500 . For each test case, output n integers: the i -th ( 1 <= i <= n ) of them should be equal to the minimum amount of coins you need to spend in order to reorder balls in the required way for k = i . In the first test case there are n = 6 balls. The colors of the balls from left to right are [ , 2, 3, 1, 4, 6, 5 ,] . Let's suppose k = 1 . One of the ways to reorder the"...

Tutorials

Codeforces Round #876 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
208345632 Tdyx D June 3, 2023, 4:33 p.m. OK C# 10 TESTS 30 186 1433600
208379681 include_BM D June 4, 2023, 3:20 a.m. OK GNU C++14 TESTS 30 46 1024000
208376547 CLOCKS_PER_SEC D June 4, 2023, 2 a.m. OK GNU C++14 TESTS 30 46 1024000
208367845 sakurasonic D June 3, 2023, 8:58 p.m. OK GNU C++14 TESTS 30 62 1024000
208345203 lin-boheng D June 3, 2023, 4:31 p.m. OK GNU C++14 TESTS 30 62 1024000
208344010 scumbag_ D June 3, 2023, 4:27 p.m. OK GNU C++14 TESTS 30 62 1024000
208334460 qzr_ D June 3, 2023, 3:55 p.m. OK GNU C++14 TESTS 30 62 1024000
208335567 markthitrin D June 3, 2023, 3:58 p.m. OK GNU C++14 TESTS 30 77 1228800
208388035 wangxiaorui D June 4, 2023, 5:58 a.m. OK GNU C++14 TESTS 30 78 1024000
208336793 nmh111 D June 3, 2023, 4:02 p.m. OK GNU C++14 TESTS 30 78 2048000
208355290 Jasonwei08 D June 3, 2023, 5:58 p.m. OK GNU C++14 TESTS 30 93 1024000
208377856 rqoi031 D June 4, 2023, 2:35 a.m. OK GNU C++17 TESTS 30 15 1024000
208381168 shdut0901 D June 4, 2023, 3:51 a.m. OK GNU C++17 TESTS 30 31 1024000
208380971 Siriushfgame D June 4, 2023, 3:47 a.m. OK GNU C++17 TESTS 30 31 1024000
208358815 mohamedeltair D June 3, 2023, 6:35 p.m. OK GNU C++17 TESTS 30 31 1024000
208343659 psychobot D June 3, 2023, 4:26 p.m. OK GNU C++17 TESTS 30 31 1024000
208338040 _abTahi_ D June 3, 2023, 4:06 p.m. OK GNU C++17 TESTS 30 31 1024000
208385938 pkljn D June 4, 2023, 5:28 a.m. OK GNU C++17 TESTS 30 46 1024000
208357280 11011b D June 3, 2023, 6:18 p.m. OK GNU C++17 TESTS 30 46 1024000
208348384 George_Rubio D June 3, 2023, 4:59 p.m. OK GNU C++17 TESTS 30 46 1024000
208338880 Caroline0926 D June 3, 2023, 4:09 p.m. OK GNU C++17 TESTS 30 46 1024000
208377829 gluchie D June 4, 2023, 2:34 a.m. OK GNU C++17 (64) TESTS 30 31 1024000
208352242 vilc D June 3, 2023, 5:27 p.m. OK GNU C++17 (64) TESTS 30 31 1024000
208333980 m.cpp D June 3, 2023, 3:53 p.m. OK GNU C++17 (64) TESTS 30 31 1024000
208341360 adamsoltan D June 3, 2023, 4:18 p.m. OK GNU C++17 (64) TESTS 30 31 1126400
208338638 __Misuki D June 3, 2023, 4:08 p.m. OK GNU C++17 (64) TESTS 30 31 2150400
208352039 placik D June 3, 2023, 5:25 p.m. OK GNU C++17 (64) TESTS 30 31 3072000
208337428 Nashville D June 3, 2023, 4:04 p.m. OK GNU C++17 (64) TESTS 30 31 4505600
208376705 Liam_Evander D June 4, 2023, 2:05 a.m. OK GNU C++17 (64) TESTS 30 46 1126400
208375831 real_pegasus D June 4, 2023, 1:37 a.m. OK GNU C++17 (64) TESTS 30 61 3993600
208377706 Historia D June 4, 2023, 2:31 a.m. OK GNU C++17 (64) TESTS 30 62 1024000
208338139 khanhphucscratch1301 D June 3, 2023, 4:06 p.m. OK GNU C++20 (64) TESTS 30 15 2048000
208377349 yumu20030130 D June 4, 2023, 2:22 a.m. OK GNU C++20 (64) TESTS 30 31 1024000
208351625 stalker120 D June 3, 2023, 5:21 p.m. OK GNU C++20 (64) TESTS 30 31 1024000
208343892 lmqzzz D June 3, 2023, 4:27 p.m. OK GNU C++20 (64) TESTS 30 31 1024000
208343522 Sheep_Li D June 3, 2023, 4:25 p.m. OK GNU C++20 (64) TESTS 30 31 1024000
208340002 dreamoon_love_AA D June 3, 2023, 4:13 p.m. OK GNU C++20 (64) TESTS 30 31 1024000
208338051 Firestone D June 3, 2023, 4:06 p.m. OK GNU C++20 (64) TESTS 30 31 2048000
208365042 shoryak D June 3, 2023, 8:09 p.m. OK GNU C++20 (64) TESTS 30 31 2150400
208373488 MinakoKojima D June 4, 2023, 12:05 a.m. OK GNU C++20 (64) TESTS 30 46 1024000
208334029 gujialiang123 D June 3, 2023, 3:53 p.m. OK GNU C++20 (64) TESTS 30 46 1024000
208345761 lis05 D June 3, 2023, 4:33 p.m. OK Go TESTS 30 1809 8294400
208338420 profchi D June 3, 2023, 4:07 p.m. OK Java 11 TESTS 30 326 0
208354900 djrfrn D June 3, 2023, 5:54 p.m. OK Java 11 TESTS 30 545 0
208385607 kkz666 D June 4, 2023, 5:22 a.m. OK Java 17 TESTS 30 280 921600
208385804 kkz666 D June 4, 2023, 5:26 a.m. OK Java 17 TESTS 30 295 819200
208352794 Dukkha D June 3, 2023, 5:33 p.m. OK Java 17 TESTS 30 436 716800
208355570 Dukkha D June 3, 2023, 6 p.m. OK Java 17 TESTS 30 436 1024000
208355322 Dukkha D June 3, 2023, 5:58 p.m. OK Java 17 TESTS 30 436 1228800
208370919 jack.t.y.wu D June 3, 2023, 10:19 p.m. OK Java 17 TESTS 30 826 1126400
208345547 Virendra115 D June 3, 2023, 4:32 p.m. OK Java 8 TESTS 30 373 0
208342237 SecondThread D June 3, 2023, 4:21 p.m. OK Java 8 TESTS 30 452 38195200
208347967 invincible777 D June 3, 2023, 4:58 p.m. OK Java 8 TESTS 30 592 0
208342791 Gaddi_Gang D June 3, 2023, 4:23 p.m. OK Java 8 TESTS 30 592 0
208347956 arvindf232 D June 3, 2023, 4:58 p.m. OK Kotlin 1.6 TESTS 30 1949 1126400
208340477 Sergey.Bankevich D June 3, 2023, 4:15 p.m. OK Kotlin 1.7 TESTS 30 1434 17817600
208382098 iktk D June 4, 2023, 4:11 a.m. OK PyPy 3-64 TESTS 30 514 5836800
208383849 iktk D June 4, 2023, 4:50 a.m. OK PyPy 3-64 TESTS 30 545 6348800
208382831 iktk D June 4, 2023, 4:29 a.m. OK PyPy 3-64 TESTS 30 561 5939200
208363682 Ayush710 D June 3, 2023, 7:46 p.m. OK PyPy 3-64 TESTS 30 623 5836800
208360041 Ayush710 D June 3, 2023, 6:52 p.m. OK PyPy 3-64 TESTS 30 639 6553600
208360199 Ayush710 D June 3, 2023, 6:54 p.m. OK PyPy 3-64 TESTS 30 655 6348800
208334634 Kita D June 3, 2023, 3:55 p.m. OK PyPy 3-64 TESTS 30 904 7782400
208355392 horrlod D June 3, 2023, 5:59 p.m. OK PyPy 3-64 TESTS 30 997 20070400
208350246 InariInDream D June 3, 2023, 5:10 p.m. OK PyPy 3-64 TESTS 30 1154 5632000
208354990 IllegalRazer D June 3, 2023, 5:55 p.m. OK PyPy 3-64 TESTS 30 1185 13209600
208333624 magnus.hegdahl D June 3, 2023, 3:52 p.m. OK Rust 2021 TESTS 30 93 1228800
208345456 codelegend D June 3, 2023, 4:32 p.m. OK Rust 2021 TESTS 30 140 2150400

remove filters

Back to search problems