Codeforces Round 881 (Div. 3)

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
1843 Codeforces Round 881 (Div. 3) FINISHED False 8100 44551499 June 20, 2023, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 34447 ) A Sasha and Array Coloring PROGRAMMING greedy sortings

B'Sasha found an array a consisting of n integers and asked you to paint elements. You have to paint each element of the array. You can use as many colors as you want, but each element should be painted into exactly one color, and for each color, there should be at least one element of that color. The cost of one color is the value of max(S) - min(S) , where S is the sequence of elements of that color. The cost of the whole coloring is the sum of costs over all colors. For example, suppose you have an array a = [ color{red}{1}, color{red}{5}, color{blue}{6}, color{blue}{3}, color{red}{4}] , and you painted its elements into two colors as follows: elements on positions 1 , 2 and 5 have color 1 ; elements on positions 3 and 4 have color 2 . Then: For the given array a , you have to calculate the maximum possible cost of the coloring. The first line contains one integer t ( 1 <= q t <= q 1000 ) -- the number of test cases. The first line of each test case contains a single integer n ( 1 <= n <= 50 ) -- length of a . The second line contains n integers a_1, a_2, ... , a_n ( 1 <= q a_i <= q 50 ) -- array a . For each test case output the maximum possible cost of the coloring. In the first example one of the optimal coloring is [ color{red}{1}, color{red}{5}, color{blue}{6}, color{blue}{3}, color{red}{4}] . The answer is (5 - 1) + (6 - 3) = 7 . In the second example, the only possible coloring is [ color{blue}{5}] , for which the answer is 5 - 5 = 0 . In the third example, the optimal coloring is [ color{blue}{1}, color{red}{6}, color{red}{3}, color{blue}{9}] , the answer is (9 - 1) + (6 - 3) = 11 . '...

Tutorials

Codeforces Round #881 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
210552471 saiful-05 A June 21, 2023, 1:39 p.m. OK C# 10 TESTS 5 46 1331200
210563223 ADNAN_ A June 21, 2023, 3:19 p.m. OK C# 10 TESTS 5 46 1638400
210565626 _lzdl_ A June 21, 2023, 3:42 p.m. OK Clang++20 Diagnostics TESTS 5 31 0
210565950 _lzdl_ A June 21, 2023, 3:45 p.m. OK Clang++20 Diagnostics TESTS 5 31 0
210516024 openJDK A June 21, 2023, 7:40 a.m. OK Clang++20 Diagnostics TESTS 5 77 0
210614348 Harshav2 A June 22, 2023, 4:09 a.m. OK Clang++20 Diagnostics TESTS 5 78 0
210550186 tranduyquan A June 21, 2023, 1:16 p.m. OK Clang++20 Diagnostics TESTS 5 93 0
210571750 retr0rev A June 21, 2023, 4:42 p.m. OK Clang++20 Diagnostics TESTS 5 109 1024000
210611853 tungfromHUSTk67 A June 22, 2023, 3:25 a.m. OK Clang++20 Diagnostics TESTS 5 124 2048000
210526477 reddykiran355 A June 21, 2023, 9:21 a.m. OK Clang++20 Diagnostics TESTS 5 124 2048000
210499954 Joseph08 A June 21, 2023, 3:21 a.m. OK GNU C11 TESTS 5 15 0
210498386 ehdxbc A June 21, 2023, 2:50 a.m. OK GNU C11 TESTS 5 15 0
210502934 tmywsh A June 21, 2023, 4:15 a.m. OK GNU C11 TESTS 5 15 0
210515941 kaizerfsixteen A June 21, 2023, 7:39 a.m. OK GNU C11 TESTS 5 15 0
210522818 lion_ark A June 21, 2023, 8:47 a.m. OK GNU C11 TESTS 5 15 0
210561966 antu21 A June 21, 2023, 3:07 p.m. OK GNU C11 TESTS 5 15 0
210524832 allout_27 A June 21, 2023, 9:05 a.m. OK GNU C11 TESTS 5 31 0
210553524 Electro-F A June 21, 2023, 1:49 p.m. OK GNU C11 TESTS 5 31 0
210557827 bhavishya.singh A June 21, 2023, 2:27 p.m. OK GNU C11 TESTS 5 31 0
210618804 achirag379 A June 22, 2023, 5:21 a.m. OK GNU C11 TESTS 5 31 0
210495637 _101111_ A June 21, 2023, 1:52 a.m. OK GNU C++14 TESTS 5 0 0
210557998 Sheeep A June 21, 2023, 2:29 p.m. OK GNU C++14 TESTS 5 0 0
210550284 include_BM A June 21, 2023, 1:17 p.m. OK GNU C++14 TESTS 5 0 0
210537179 deepak_learner A June 21, 2023, 11:10 a.m. OK GNU C++14 TESTS 5 0 0
210527711 _iostream_ A June 21, 2023, 9:33 a.m. OK GNU C++14 TESTS 5 0 0
210512728 Donia99 A June 21, 2023, 7:04 a.m. OK GNU C++14 TESTS 5 0 0
210495953 666long A June 21, 2023, 1:59 a.m. OK GNU C++14 TESTS 5 0 0
210534660 Ikila07 A June 21, 2023, 10:44 a.m. OK GNU C++14 TESTS 5 0 102400
210554711 __NOOo.oOOB__ A June 21, 2023, 2 p.m. OK GNU C++14 TESTS 5 0 102400
210606480 kabu A June 22, 2023, 1:42 a.m. OK GNU C++14 TESTS 5 0 102400
210515541 Ram-Gopal A June 21, 2023, 7:34 a.m. OK GNU C++17 TESTS 5 0 0
210607188 Murinh0 A June 22, 2023, 1:56 a.m. OK GNU C++17 TESTS 5 0 0
210618301 JobairHasib A June 22, 2023, 5:12 a.m. OK GNU C++17 TESTS 5 0 0
210552041 wayofwater A June 21, 2023, 1:35 p.m. OK GNU C++17 TESTS 5 0 0
210554598 Admiral_Auditore A June 21, 2023, 1:59 p.m. OK GNU C++17 TESTS 5 0 0
210560901 joodias A June 21, 2023, 2:57 p.m. OK GNU C++17 TESTS 5 0 0
210566651 Mohamed.Rayek A June 21, 2023, 3:52 p.m. OK GNU C++17 TESTS 5 0 0
210567560 Norge_Rubio A June 21, 2023, 4:01 p.m. OK GNU C++17 TESTS 5 0 0
210519369 lzy-2002 A June 21, 2023, 8:14 a.m. OK GNU C++17 TESTS 5 0 0
210516083 Walid-Hawara A June 21, 2023, 7:40 a.m. OK GNU C++17 TESTS 5 0 0
210502973 devansh12_ A June 21, 2023, 4:16 a.m. OK GNU C++17 (64) TESTS 5 0 0
210620073 himanshupatil45h A June 22, 2023, 5:42 a.m. OK GNU C++17 (64) TESTS 5 0 0
210602488 Don A June 22, 2023, 12:15 a.m. OK GNU C++17 (64) TESTS 5 0 0
210600689 ahmed.yasser01 A June 21, 2023, 11:33 p.m. OK GNU C++17 (64) TESTS 5 0 0
210577630 hippo19 A June 21, 2023, 5:47 p.m. OK GNU C++17 (64) TESTS 5 0 0
210576384 DAIIIS A June 21, 2023, 5:32 p.m. OK GNU C++17 (64) TESTS 5 0 0
210571302 samyaksk10 A June 21, 2023, 4:37 p.m. OK GNU C++17 (64) TESTS 5 0 0
210562103 monovariant A June 21, 2023, 3:09 p.m. OK GNU C++17 (64) TESTS 5 0 0
210552852 benslamaoussama1919 A June 21, 2023, 1:42 p.m. OK GNU C++17 (64) TESTS 5 0 0
210514821 Xudinger A June 21, 2023, 7:26 a.m. OK GNU C++17 (64) TESTS 5 0 0
210601603 abOrtiVe17 A June 21, 2023, 11:55 p.m. OK GNU C++20 (64) TESTS 5 0 0
210603158 Khaled_Ahmad A June 22, 2023, 12:31 a.m. OK GNU C++20 (64) TESTS 5 0 0
210603467 __shikhar_007 A June 22, 2023, 12:39 a.m. OK GNU C++20 (64) TESTS 5 0 0
210608102 Reducing-Sugar A June 22, 2023, 2:13 a.m. OK GNU C++20 (64) TESTS 5 0 0
210611237 8551 A June 22, 2023, 3:14 a.m. OK GNU C++20 (64) TESTS 5 0 0
210613754 __Slayer__ A June 22, 2023, 3:59 a.m. OK GNU C++20 (64) TESTS 5 0 0
210619773 fsjhhh A June 22, 2023, 5:37 a.m. OK GNU C++20 (64) TESTS 5 0 0
210619900 Cylarus A June 22, 2023, 5:39 a.m. OK GNU C++20 (64) TESTS 5 0 0
210620066 Anmol_Bansal A June 22, 2023, 5:42 a.m. OK GNU C++20 (64) TESTS 5 0 0
210621053 fn__kotha A June 22, 2023, 5:58 a.m. OK GNU C++20 (64) TESTS 5 0 0
210495136 libaoshan A June 21, 2023, 1:39 a.m. OK Go TESTS 5 15 307200
210581982 kalzor A June 21, 2023, 6:39 p.m. OK Java 11 TESTS 5 155 0
210583329 themadknight45 A June 21, 2023, 6:59 p.m. OK Java 11 TESTS 5 156 0
210497901 new2ac A June 21, 2023, 2:41 a.m. OK Java 11 TESTS 5 171 0
210561731 ayushgaur02 A June 21, 2023, 3:05 p.m. OK Java 11 TESTS 5 186 0
210554876 priyapathak24.07 A June 21, 2023, 2:02 p.m. OK Java 11 TESTS 5 187 0
210522178 thenikhilkakarla A June 21, 2023, 8:41 a.m. OK Java 11 TESTS 5 187 0
210611435 mayer2510 A June 22, 2023, 3:18 a.m. OK Java 11 TESTS 5 202 0
210544689 polsage A June 21, 2023, 12:25 p.m. OK Java 11 TESTS 5 217 0
210522671 md_shamim_ahmmed A June 21, 2023, 8:45 a.m. OK Java 11 TESTS 5 218 0
210495975 diegoprada005 A June 21, 2023, 2 a.m. OK Java 11 TESTS 5 218 0
210505792 luci9868 A June 21, 2023, 5:08 a.m. OK Java 17 TESTS 5 155 409600
210613472 less_ordinary A June 22, 2023, 3:54 a.m. OK Java 17 TESTS 5 155 716800
210516490 vikash_45 A June 21, 2023, 7:45 a.m. OK Java 17 TESTS 5 170 512000
210535361 mansurzq2 A June 21, 2023, 10:52 a.m. OK Java 17 TESTS 5 171 0
210520999 coder_vishnu A June 21, 2023, 8:30 a.m. OK Java 17 TESTS 5 171 204800
210529642 unstoppableforce A June 21, 2023, 9:51 a.m. OK Java 17 TESTS 5 171 409600
210542153 jimmyd211 A June 21, 2023, 12:01 p.m. OK Java 17 TESTS 5 186 307200
210533870 soumit915 A June 21, 2023, 10:35 a.m. OK Java 17 TESTS 5 186 409600
210550873 Rohith_Kumar_Reddy A June 21, 2023, 1:24 p.m. OK Java 17 TESTS 5 187 0
210619960 cpp10 A June 22, 2023, 5:40 a.m. OK Java 17 TESTS 5 187 512000
210536171 Pradeep880 A June 21, 2023, 11 a.m. OK Java 8 TESTS 5 93 0
210499914 magic_kid A June 21, 2023, 3:20 a.m. OK Java 8 TESTS 5 93 0
210497439 chuquwan9964 A June 21, 2023, 2:31 a.m. OK Java 8 TESTS 5 93 0
210555742 WalterWhite. A June 21, 2023, 2:09 p.m. OK Java 8 TESTS 5 108 0
210503245 rras A June 21, 2023, 4:21 a.m. OK Java 8 TESTS 5 108 0
210606185 Monkey_de_Luffy A June 22, 2023, 1:37 a.m. OK Java 8 TESTS 5 109 0
210528080 esmusssein A June 21, 2023, 9:37 a.m. OK Java 8 TESTS 5 124 38400000
210496759 Ahmad_Hoseiny A June 21, 2023, 2:17 a.m. OK Java 8 TESTS 5 139 0
210505043 Juhaied_nabid A June 21, 2023, 4:54 a.m. OK Java 8 TESTS 5 155 0
210502014 2100031826_klu A June 21, 2023, 3:59 a.m. OK Java 8 TESTS 5 155 0
210541364 EslamAla1 A June 21, 2023, 11:53 a.m. OK JavaScript TESTS 5 30 2355200
210535150 hartiksalaria A June 21, 2023, 10:49 a.m. OK Kotlin 1.6 TESTS 5 186 409600
210540874 linxiaotian A June 21, 2023, 11:47 a.m. OK Kotlin 1.6 TESTS 5 187 614400
210600543 _Ahmed_Samy A June 21, 2023, 11:30 p.m. OK Kotlin 1.7 TESTS 5 342 6963200
210560251 286d A June 21, 2023, 2:51 p.m. OK MS C++ 2017 TESTS 5 15 0
210525148 At1L A June 21, 2023, 9:09 a.m. OK MS C++ 2017 TESTS 5 15 0
210549053 samia_safa A June 21, 2023, 1:06 p.m. OK MS C++ 2017 TESTS 5 30 0
210520406 Ganseblumchen A June 21, 2023, 8:24 a.m. OK MS C++ 2017 TESTS 5 31 0
210596311 jaba0192837465 A June 21, 2023, 10:06 p.m. OK MS C++ 2017 TESTS 5 31 0
210585510 asif1zero2 A June 21, 2023, 7:30 p.m. OK Node.js TESTS 5 77 2764800
210585084 asif1zero2 A June 21, 2023, 7:24 p.m. OK Node.js TESTS 5 155 4608000
210584196 patulka A June 21, 2023, 7:11 p.m. OK PyPy 3 TESTS 5 93 2764800
210581594 BLACKDEX09 A June 21, 2023, 6:34 p.m. OK PyPy 3 TESTS 5 139 5529600
210495799 MHAII A June 21, 2023, 1:55 a.m. OK PyPy 3 TESTS 5 140 5120000
210573436 Astar288 A June 21, 2023, 4:59 p.m. OK PyPy 3 TESTS 5 155 4608000
210560077 LCJLY A June 21, 2023, 2:49 p.m. OK PyPy 3 TESTS 5 155 4812800
210519276 K1o0n A June 21, 2023, 8:13 a.m. OK PyPy 3 TESTS 5 156 4915200
210524771 nevermind___ A June 21, 2023, 9:05 a.m. OK PyPy 3 TESTS 5 186 4608000
210525016 ram_1728 A June 21, 2023, 9:07 a.m. OK PyPy 3 TESTS 5 187 5120000
210544370 umantsiv_nazar A June 21, 2023, 12:22 p.m. OK PyPy 3 TESTS 5 202 5632000
210620951 Michael_V A June 22, 2023, 5:56 a.m. OK PyPy 3-64 TESTS 5 61 3379200
210540766 byteman_xzj A June 21, 2023, 11:46 a.m. OK PyPy 3-64 TESTS 5 61 34611200
210505459 rq170 A June 21, 2023, 5:02 a.m. OK PyPy 3-64 TESTS 5 77 2867200
210562543 Youarenotgood A June 21, 2023, 3:13 p.m. OK PyPy 3-64 TESTS 5 77 3072000
210556616 riroan A June 21, 2023, 2:17 p.m. OK PyPy 3-64 TESTS 5 77 3584000
210609717 Raindrops1117 A June 22, 2023, 2:44 a.m. OK PyPy 3-64 TESTS 5 77 4403200
210603166 pedrosorio A June 22, 2023, 12:31 a.m. OK PyPy 3-64 TESTS 5 78 4198400
210558307 Durumari A June 21, 2023, 2:32 p.m. OK PyPy 3-64 TESTS 5 93 2457600
210521420 tu144x A June 21, 2023, 8:34 a.m. OK PyPy 3-64 TESTS 5 93 3174400
210579342 mathiaswk A June 21, 2023, 6:07 p.m. OK PyPy 3-64 TESTS 5 93 3276800
210608773 vyacheslavovich A June 22, 2023, 2:26 a.m. OK Python 3 TESTS 5 31 0
210586777 UdayUSR A June 21, 2023, 7:48 p.m. OK Python 3 TESTS 5 31 0
210585657 Mohamed_Mostafaa A June 21, 2023, 7:32 p.m. OK Python 3 TESTS 5 31 0
210581315 oilime A June 21, 2023, 6:30 p.m. OK Python 3 TESTS 5 31 0
210576152 SpaYaM A June 21, 2023, 5:30 p.m. OK Python 3 TESTS 5 31 0
210563736 abhipraay A June 21, 2023, 3:24 p.m. OK Python 3 TESTS 5 31 0
210546538 keshu71 A June 21, 2023, 12:43 p.m. OK Python 3 TESTS 5 31 0
210504514 omnamonarayana A June 21, 2023, 4:44 a.m. OK Python 3 TESTS 5 31 0
210494948 undecoded_123 A June 21, 2023, 1:34 a.m. OK Python 3 TESTS 5 31 0
210494388 jai2151513 A June 21, 2023, 1:21 a.m. OK Python 3 TESTS 5 31 0
210539209 Stan_Marsh Kenny__McCormick Thief_Executive_Officer A June 21, 2023, 11:31 a.m. OK Rust 2021 TESTS 5 15 0

remove filters

Back to search problems