Educational Codeforces Round 178 (Rated for 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
2104 Educational Codeforces Round 178 (Rated for Div. 2) FINISHED False 7200 30554723 April 28, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 20608 ) B Move to the End PROGRAMMING brute force data structures dp greedy

You are given an array (a) consisting of (n) integers. For every integer (k) from (1) to (n), you have to do the following: choose an arbitrary element of (a) and move it to the right end of the array (you can choose the last element, then the array won't change); print the sum of (k) last elements of (a); move the element you've chosen on the first step to its original position (restore the original array (a)). For every (k), you choose the element which you move so that the value you print is the maximum possible . Calculate the value you print for every (k). The first line contains one integer (t) ((1 \le t \le 10^4)) — the number of test cases. Each test case consists of two lines: the first line contains one integer (n) ((1 \le n \le 2 \cdot 10^5)); the second line contains (n) integers (a_1, a_2, \dots, a_n) ((1 \le a_i \le 10^9)). Additional constraint on the input: the sum of (n) over all test cases does not exceed (2 \cdot 10^5). For each test case, print (n) integers. The (i)-th of these integers should be equal to the maximum value you can print if (k=i). Let's consider the first test case from the statement: when (k = 1), you can move the (6)-th element to the end, the array becomes (13, 5, 10, 14, 8, 13, 15), and the value you print is (15); when (k = 2), you can move the (6)-th element to the end, the array becomes (13, 5, 10, 14, 8, 13, 15), and the value you print is (13 + 15 = 28); when (k = 3), you can move the (4)-th element to the end, the array becomes (13, 5, 10, 8, 15, 13, 14), and the value you print is (15 + 13 + 14 = 42); when (k = 4), you can move the (5)-th element to the end, the array becomes (13, 5, 10, 14, 15, 13, 8), and the value you print is (14 + 15 + 13 + 8 = 50); when (k = 5), you can move the (1)-st element to the end, the array becomes $$$[5, 10, 1

Tutorials

Educational Codeforces Round 178 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
317675539 shahadat26 B April 28, 2025, 8:58 p.m. OK C# 10 TESTS 4 468 28467200
317656029 divine_12 B April 28, 2025, 5:14 p.m. OK C++17 (GCC 7-32) TESTS 4 108 1126400
317651411 Alashmawy B April 28, 2025, 4:33 p.m. OK C++17 (GCC 7-32) TESTS 4 108 1126400
317686685 fly_1 B April 29, 2025, 2:01 a.m. OK C++17 (GCC 7-32) TESTS 4 109 0
317658496 Hazemkamal B April 28, 2025, 5:34 p.m. OK C++17 (GCC 7-32) TESTS 4 109 0
317700074 ninja_one B April 29, 2025, 6 a.m. OK C++17 (GCC 7-32) TESTS 4 124 0
317694771 lnight121 B April 29, 2025, 4:50 a.m. OK C++17 (GCC 7-32) TESTS 4 124 0
317688620 phtung0701 B April 29, 2025, 2:47 a.m. OK C++17 (GCC 7-32) TESTS 4 124 0
317688042 Sabbir211 B April 29, 2025, 2:34 a.m. OK C++17 (GCC 7-32) TESTS 4 124 0
317664706 CoDeR__BrO B April 28, 2025, 6:31 p.m. OK C++17 (GCC 7-32) TESTS 4 124 0
317658100 gourav100110 B April 28, 2025, 5:31 p.m. OK C++17 (GCC 7-32) TESTS 4 124 0
317674932 TMQuitten B April 28, 2025, 8:47 p.m. OK C++20 (GCC 13-64) TESTS 4 46 4505600
317658939 NITUL_ B April 28, 2025, 5:38 p.m. OK C++20 (GCC 13-64) TESTS 4 62 0
317668937 Abuseini B April 28, 2025, 7:21 p.m. OK C++20 (GCC 13-64) TESTS 4 62 1126400
317698961 StarNightSnow B April 29, 2025, 5:48 a.m. OK C++20 (GCC 13-64) TESTS 4 77 0
317693627 Kshitij62 B April 29, 2025, 4:29 a.m. OK C++20 (GCC 13-64) TESTS 4 77 0
317684484 brainsoft B April 29, 2025, 1:03 a.m. OK C++20 (GCC 13-64) TESTS 4 77 0
317677646 shiinamashiro_ B April 28, 2025, 9:45 p.m. OK C++20 (GCC 13-64) TESTS 4 77 0
317669082 Naimu B April 28, 2025, 7:22 p.m. OK C++20 (GCC 13-64) TESTS 4 77 0
317666723 RafsaniShazid B April 28, 2025, 6:57 p.m. OK C++20 (GCC 13-64) TESTS 4 77 0
317656341 Pioneer_ B April 28, 2025, 5:17 p.m. OK C++20 (GCC 13-64) TESTS 4 77 0
317679928 cooluo B April 28, 2025, 10:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 46 6963200
317686351 RoadToLGM_CF B April 29, 2025, 1:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 61 4812800
317694577 goromPani B April 29, 2025, 4:47 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 77 0
317694555 SiamArif B April 29, 2025, 4:47 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 77 0
317687939 Avem B April 29, 2025, 2:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 77 0
317683574 Imam346 B April 29, 2025, 12:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 77 0
317682340 eysikin B April 28, 2025, 11:54 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 77 0
317679131 A_G B April 28, 2025, 10:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 77 0
317677129 RoninMello B April 28, 2025, 9:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 77 0
317665862 afakeusername B April 28, 2025, 6:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 77 0
317674384 NenadDapic B April 28, 2025, 8:38 p.m. OK FPC TESTS 4 296 1638400
317696456 tkddn5623 B April 29, 2025, 5:17 a.m. OK GNU C11 TESTS 4 109 5324800
317649485 dj.nagisa B April 28, 2025, 4:28 p.m. OK GNU C11 TESTS 4 921 2457600
317688622 konziyue B April 29, 2025, 2:47 a.m. OK GNU C11 TESTS 4 937 1536000
317642965 tranquyetthang281 B April 28, 2025, 4:12 p.m. OK Go TESTS 4 233 15974400
317687089 Freedom_lifelong B April 29, 2025, 2:11 a.m. OK Java 21 TESTS 4 264 921600
317674225 Master_Shifu46 B April 28, 2025, 8:35 p.m. OK Java 21 TESTS 4 296 7680000
317647606 diringn B April 28, 2025, 4:24 p.m. OK Java 21 TESTS 4 296 9216000
317641629 Bhupender_rathod B April 28, 2025, 4:09 p.m. OK Java 21 TESTS 4 296 20582400
317648246 rakesh23241a6752 B April 28, 2025, 4:25 p.m. OK Java 21 TESTS 4 311 7782400
317662647 akshatsaxena552004.ss B April 28, 2025, 6:11 p.m. OK Java 21 TESTS 4 312 7168000
317659037 Balu2907 B April 28, 2025, 5:39 p.m. OK Java 21 TESTS 4 327 614400
317648882 Xero_ B April 28, 2025, 4:27 p.m. OK Java 21 TESTS 4 327 1740800
317650542 rakesh4030 B April 28, 2025, 4:31 p.m. OK Java 21 TESTS 4 327 8396800
317650431 LimitlessOps B April 28, 2025, 4:31 p.m. OK Java 21 TESTS 4 328 409600
317669693 yashdhokia B April 28, 2025, 7:29 p.m. OK Java 8 TESTS 4 233 3788800
317662528 Ronit0211 B April 28, 2025, 6:10 p.m. OK Java 8 TESTS 4 264 7168000
317700172 codexzx B April 29, 2025, 6:01 a.m. OK Java 8 TESTS 4 390 0
317659819 Akshatgupta069_069 B April 28, 2025, 5:46 p.m. OK Java 8 TESTS 4 453 3788800
317645581 ajay.code04 B April 28, 2025, 4:19 p.m. OK Java 8 TESTS 4 546 3584000
317650407 yashu_rai B April 28, 2025, 4:31 p.m. OK Java 8 TESTS 4 703 5939200
317693295 mproshan968 B April 29, 2025, 4:23 a.m. OK Java 8 TESTS 4 718 0
317690516 adarsh400 B April 29, 2025, 3:28 a.m. OK Java 8 TESTS 4 749 0
317654935 hiddenhopes B April 28, 2025, 5:08 p.m. OK Java 8 TESTS 4 749 0
317663344 harxhhhh B April 28, 2025, 6:18 p.m. OK Java 8 TESTS 4 749 5222400
317649948 iitamansharma B April 28, 2025, 4:29 p.m. OK Kotlin 1.9 TESTS 4 874 6758400
317648163 dioxkjpde B April 28, 2025, 4:25 p.m. OK Mono C# TESTS 4 234 41676800
317644212 Eevee8845 B April 28, 2025, 4:15 p.m. OK Node.js TESTS 4 265 73932800
317677637 mythicalrocket B April 28, 2025, 9:44 p.m. OK PyPy 3 TESTS 4 342 38502400
317649022 dreamer_empty B April 28, 2025, 4:27 p.m. OK PyPy 3 TESTS 4 686 19763200
317683668 Darooha B April 29, 2025, 12:38 a.m. OK PyPy 3 TESTS 4 686 25702400
317700322 gardengnome B April 29, 2025, 6:02 a.m. OK PyPy 3-64 TESTS 4 139 26828800
317691066 siic B April 29, 2025, 3:38 a.m. OK PyPy 3-64 TESTS 4 140 26931200
317698980 EIR94326 B April 29, 2025, 5:48 a.m. OK PyPy 3-64 TESTS 4 155 24678400
317697003 CodeBharat B April 29, 2025, 5:24 a.m. OK PyPy 3-64 TESTS 4 155 26828800
317690545 sahcgahxbjasxguqwg B April 29, 2025, 3:28 a.m. OK PyPy 3-64 TESTS 4 155 30208000
317700581 N1664 B April 29, 2025, 6:05 a.m. OK PyPy 3-64 TESTS 4 156 27136000
317689446 lawang24 B April 29, 2025, 3:05 a.m. OK PyPy 3-64 TESTS 4 171 26009600
317695690 deepbuha06 B April 29, 2025, 5:06 a.m. OK PyPy 3-64 TESTS 4 171 26521600
317680905 yassinearfaoui131 ayyoub.mkadmi3 B April 28, 2025, 11:08 p.m. OK PyPy 3-64 TESTS 4 171 26726400
317692454 nwblanton B April 29, 2025, 4:05 a.m. OK PyPy 3-64 TESTS 4 171 32051200
317647883 alejan.mr2007 B April 28, 2025, 4:24 p.m. OK Python 3 TESTS 4 249 64614400
317641620 JGSSU B April 28, 2025, 4:09 p.m. OK Python 3 TESTS 4 281 64614400
317648737 jashwanthnani B April 28, 2025, 4:26 p.m. OK Python 3 TESTS 4 312 53145600
317643288 Jaardo B April 28, 2025, 4:13 p.m. OK Python 3 TESTS 4 327 38809600
317671616 divyamkakkar24 B April 28, 2025, 7:53 p.m. OK Python 3 TESTS 4 342 27955200
317673336 DesiCoder B April 28, 2025, 8:21 p.m. OK Python 3 TESTS 4 343 26624000
317647379 Abhiram6_ B April 28, 2025, 4:23 p.m. OK Python 3 TESTS 4 343 39321600
317657547 AggarwalRaghav B April 28, 2025, 5:26 p.m. OK Python 3 TESTS 4 359 28057600
317644300 vsc07 B April 28, 2025, 4:16 p.m. OK Python 3 TESTS 4 374 39116800
317643113 23ag1a0545 B April 28, 2025, 4:13 p.m. OK Python 3 TESTS 4 389 39116800
317671234 vstiff B April 28, 2025, 7:48 p.m. OK Rust 2021 TESTS 4 62 2048000
317681888 SamuelLH B April 28, 2025, 11:38 p.m. OK Rust 2021 TESTS 4 78 7270400
317693582 silicalet B April 29, 2025, 4:28 a.m. OK Rust 2021 TESTS 4 187 23552000

remove filters

Back to search problems