Educational Codeforces Round 179 (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
2111 Educational Codeforces Round 179 (Rated for Div. 2) FINISHED False 7200 27444323 June 3, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 19304 ) C Equal Values PROGRAMMING brute force two pointers

You are given an array (a_1, a_2, \dots, a_n), consisting of (n) integers. In one operation, you are allowed to perform one of the following actions: Choose a position (i) ((1 < i \le n)) and make all elements to the left of (i) equal to (a_i). That is, assign the value (a_i) to all (a_j) ((1 \le j < i)). The cost of such an operation is ((i - 1) \cdot a_i). Choose a position (i) ((1 \le i < n)) and make all elements to the right of (i) equal to (a_i). That is, assign the value (a_i) to all (a_j) ((i < j \le n)). The cost of such an operation is ((n - i) \cdot a_i). Note that the elements affected by an operation may already be equal to (a_i), but that doesn't change the cost. You are allowed to perform any number of operations (including zero). What is the minimum total cost to make all elements of the array equal? The first line contains one integer (t) ((1 \le t \le 10^4)) — the number of test cases. The first line of each test case contains a single integer (n) ((2 \le n \le 5 \cdot 10^5)). The second line contains (n) integers (a_1, a_2, \dots, a_n) ((1 \le a_i \le n)). The sum of (n) over all test cases does not exceed (5 \cdot 10^5). For each test case, print a single integer — the minimum total cost of operations to make all elements of the array equal. In the first test case, you can perform the operation twice: choose (i = 3) and make all elements to the left of it equal to it, the cost will be (2 \cdot 1 = 2); choose (i = 3) and make all elements to the right of it equal to it, the cost will be (1 \cdot 1 = 1). The total cost is (2 + 1 = 3). In the second test case, all elements are already equal, so no operations need to be performed.

Tutorials

Educational Codeforces Round 179 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
322793235 IoI-IITC C June 4, 2025, 3:04 a.m. OK C# 10 TESTS 14 234 45158400
322786639 whiteedu C June 4, 2025, 12:39 a.m. OK C++17 (GCC 7-32) TESTS 14 124 0
322853213 Nhanmuaairi C June 4, 2025, 11:58 a.m. OK C++17 (GCC 7-32) TESTS 14 124 2048000
322899349 vibhashbhushan C June 4, 2025, 6:10 p.m. OK C++17 (GCC 7-32) TESTS 14 125 0
322834000 kk1213g C June 4, 2025, 9:34 a.m. OK C++17 (GCC 7-32) TESTS 14 125 0
322801094 Tech_Exemplary C June 4, 2025, 4:57 a.m. OK C++17 (GCC 7-32) TESTS 14 125 0
322875704 sumit228 C June 4, 2025, 2:46 p.m. OK C++17 (GCC 7-32) TESTS 14 125 102400
322876710 ruhan.habib39 C June 4, 2025, 2:54 p.m. OK C++17 (GCC 7-32) TESTS 14 125 4096000
322930098 3shry_mo C June 5, 2025, 4 a.m. OK C++17 (GCC 7-32) TESTS 14 139 0
322868783 xiaowang524 C June 4, 2025, 1:53 p.m. OK C++17 (GCC 7-32) TESTS 14 139 102400
322911685 Raval_Kush_ C June 4, 2025, 8:49 p.m. OK C++17 (GCC 7-32) TESTS 14 140 0
322797558 Anamul_102 C June 4, 2025, 4:10 a.m. OK C++20 (GCC 13-64) TESTS 14 109 0
322881107 acidLemon C June 4, 2025, 3:30 p.m. OK C++20 (GCC 13-64) TESTS 14 109 0
322854061 Mythresh_1826 C June 4, 2025, 12:04 p.m. OK C++20 (GCC 13-64) TESTS 14 109 102400
322854751 harihar2909 C June 4, 2025, 12:08 p.m. OK C++20 (GCC 13-64) TESTS 14 109 307200
322903160 TheM0NK C June 4, 2025, 6:47 p.m. OK C++20 (GCC 13-64) TESTS 14 109 307200
322902451 JesterKing C June 4, 2025, 6:39 p.m. OK C++20 (GCC 13-64) TESTS 14 109 307200
322801608 KK7 C June 4, 2025, 5:03 a.m. OK C++20 (GCC 13-64) TESTS 14 109 307200
322917924 NassimKraiem C June 4, 2025, 11:33 p.m. OK C++20 (GCC 13-64) TESTS 14 109 409600
322888612 cicada3298 C June 4, 2025, 4:35 p.m. OK C++20 (GCC 13-64) TESTS 14 109 409600
322882440 Platon_rumilov C June 4, 2025, 3:41 p.m. OK C++20 (GCC 13-64) TESTS 14 109 4096000
322825014 alsharis C June 4, 2025, 8:35 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 108 2048000
322844244 iamaryankr C June 4, 2025, 10:50 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 109 0
322881182 Pratyushdumdumb C June 4, 2025, 3:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 109 0
322860786 YadavArsh96 C June 4, 2025, 12:54 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 109 102400
322937317 azureboy C June 5, 2025, 5:23 a.m. OK C++23 (GCC 14-64, msys2) TESTS 14 109 102400
322904627 arhamkachhara15 C June 4, 2025, 7:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 109 102400
322870794 rkbhati0105 C June 4, 2025, 2:08 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 109 409600
322917563 Liminha C June 4, 2025, 11:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 109 409600
322913698 Zxpty C June 4, 2025, 9:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 109 409600
322872367 indulgence_ C June 4, 2025, 2:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 14 109 409600
322866164 bluemegane C June 4, 2025, 1:34 p.m. OK C# 8 TESTS 14 202 37273600
322777817 1435730 C June 3, 2025, 8:57 p.m. OK GNU C11 TESTS 14 124 102400
322925766 zucltg C June 5, 2025, 3:03 a.m. OK GNU C11 TESTS 14 124 2048000
322840057 tea_123__ C June 4, 2025, 10:18 a.m. OK GNU C11 TESTS 14 124 2048000
322832870 MrWizard_574 C June 4, 2025, 9:26 a.m. OK GNU C11 TESTS 14 124 3993600
322857910 nahida520 C June 4, 2025, 12:31 p.m. OK GNU C11 TESTS 14 139 4096000
322832504 MrWizard_574 C June 4, 2025, 9:24 a.m. OK GNU C11 TESTS 14 139 4096000
322838039 kartik_765 C June 4, 2025, 10:02 a.m. OK GNU C11 TESTS 14 140 1945600
322832679 MrWizard_574 C June 4, 2025, 9:25 a.m. OK GNU C11 TESTS 14 140 3993600
322834057 MrWizard_574 C June 4, 2025, 9:35 a.m. OK GNU C11 TESTS 14 140 4096000
322833096 MrWizard_574 C June 4, 2025, 9:28 a.m. OK GNU C11 TESTS 14 155 3993600
322932535 tekka_ity C June 5, 2025, 4:31 a.m. OK Java 21 TESTS 14 249 819200
322883203 aaryanman05 C June 4, 2025, 3:48 p.m. OK Java 21 TESTS 14 265 819200
322790336 HarhsSoni C June 4, 2025, 2:13 a.m. OK Java 21 TESTS 14 280 921600
322785522 shaham C June 3, 2025, 11:57 p.m. OK Java 21 TESTS 14 328 11366400
322845696 Shreyas0803 C June 4, 2025, 11:02 a.m. OK Java 21 TESTS 14 343 7168000
322844185 yashjaiswal2509 C June 4, 2025, 10:50 a.m. OK Java 21 TESTS 14 358 7680000
322799003 yashjaiswal2509 C June 4, 2025, 4:32 a.m. OK Java 21 TESTS 14 358 9523200
322834535 ikiku C June 4, 2025, 9:38 a.m. OK Java 21 TESTS 14 374 1024000
322785548 shaham C June 3, 2025, 11:58 p.m. OK Java 21 TESTS 14 374 10547200
322823788 snehakanodia4 C June 4, 2025, 8:26 a.m. OK Java 21 TESTS 14 389 71782400
322878949 arpande97 C June 4, 2025, 3:12 p.m. OK Java 8 TESTS 14 139 0
322917173 Potato_Pc C June 4, 2025, 11:05 p.m. OK Java 8 TESTS 14 156 0
322919599 NischayCodes C June 5, 2025, 12:41 a.m. OK Java 8 TESTS 14 218 12083200
322827219 sarthaKKharKa_18 C June 4, 2025, 8:50 a.m. OK Java 8 TESTS 14 281 18022400
322844693 not_mohith C June 4, 2025, 10:54 a.m. OK Java 8 TESTS 14 718 0
322783949 jagadeeshmamilla129 C June 3, 2025, 10:59 p.m. OK Java 8 TESTS 14 733 0
322784640 jagadeeshmamilla129 C June 3, 2025, 11:24 p.m. OK Java 8 TESTS 14 764 0
322840209 not_mohith C June 4, 2025, 10:19 a.m. OK Java 8 TESTS 14 765 0
322803201 arnabpachal2004 C June 4, 2025, 5:20 a.m. OK Java 8 TESTS 14 765 0
322826441 warframe C June 4, 2025, 8:45 a.m. OK Java 8 TESTS 14 796 0
322906102 sambodhi7 C June 4, 2025, 7:23 p.m. OK PyPy 3 TESTS 14 452 29184000
322906354 sambodhi7 C June 4, 2025, 7:26 p.m. OK PyPy 3 TESTS 14 484 28979200
322792436 HardikAggarwal45 C June 4, 2025, 2:50 a.m. OK PyPy 3 TESTS 14 515 44646400
322835639 Tgupta C June 4, 2025, 9:46 a.m. OK PyPy 3 TESTS 14 546 43110400
322826361 santhoshsparky C June 4, 2025, 8:44 a.m. OK PyPy 3 TESTS 14 562 45670400
322846974 kridant_kumar C June 4, 2025, 11:11 a.m. OK PyPy 3 TESTS 14 593 44544000
322856844 Mayank_g4104 C June 4, 2025, 12:23 p.m. OK PyPy 3-64 TESTS 14 187 53760000
322923752 sjnikolas123 C June 5, 2025, 2:27 a.m. OK PyPy 3-64 TESTS 14 202 45260800
322893740 Topist C June 4, 2025, 5:20 p.m. OK PyPy 3-64 TESTS 14 202 53248000
322817334 OAY71011 C June 4, 2025, 7:39 a.m. OK PyPy 3-64 TESTS 14 202 53248000
322898218 arinchopra C June 4, 2025, 5:59 p.m. OK PyPy 3-64 TESTS 14 202 53452800
322798764 gardengnome C June 4, 2025, 4:29 a.m. OK PyPy 3-64 TESTS 14 202 53760000
322887331 Deemo_ML C June 4, 2025, 4:24 p.m. OK PyPy 3-64 TESTS 14 202 53862400
322855592 Kabish07 C June 4, 2025, 12:14 p.m. OK PyPy 3-64 TESTS 14 202 59904000
322864686 Divyanshu52Singhal C June 4, 2025, 1:23 p.m. OK PyPy 3-64 TESTS 14 202 60416000
322790687 hxu10 C June 4, 2025, 2:19 a.m. OK PyPy 3-64 TESTS 14 202 68403200
322829016 sw0405 C June 4, 2025, 9:03 a.m. OK Python 3 TESTS 14 250 53555200
322817986 shanks_jr10 C June 4, 2025, 7:44 a.m. OK Python 3 TESTS 14 281 54374400
322884481 luciferstern C June 4, 2025, 3:59 p.m. OK Python 3 TESTS 14 296 54374400
322850573 Jiraiya6741 C June 4, 2025, 11:38 a.m. OK Python 3 TESTS 14 296 55091200
322788964 dipak12.11 C June 4, 2025, 1:42 a.m. OK Python 3 TESTS 14 358 53657600
322799780 liuzm7070 C June 4, 2025, 4:42 a.m. OK Python 3 TESTS 14 405 52428800
322853533 ashvathhb C June 4, 2025, noon OK Python 3 TESTS 14 452 53862400
322790791 eMD0gG C June 4, 2025, 2:21 a.m. OK Python 3 TESTS 14 483 54272000
322834940 ___a_s_1_2___ C June 4, 2025, 9:41 a.m. OK Python 3 TESTS 14 561 53964800
322799608 abhay_82 C June 4, 2025, 4:40 a.m. OK Python 3 TESTS 14 593 52531200
322799431 0x81 C June 4, 2025, 4:38 a.m. OK Rust 2021 TESTS 14 62 7577600
322821228 Playnext C June 4, 2025, 8:08 a.m. OK Rust 2021 TESTS 14 77 7270400
322837715 ton C June 4, 2025, 10 a.m. OK Rust 2021 TESTS 14 77 11366400
322902388 DanielAnker C June 4, 2025, 6:38 p.m. OK Rust 2021 TESTS 14 93 8908800
322858403 SAURABHCJAVA C June 4, 2025, 12:35 p.m. OK Rust 2021 TESTS 14 93 20172800
322835944 ton C June 4, 2025, 9:48 a.m. OK Rust 2021 TESTS 14 108 11264000
322892960 quasar142857 C June 4, 2025, 5:13 p.m. OK Rust 2021 TESTS 14 124 30412800
322865482 cinkozzz C June 4, 2025, 1:28 p.m. OK Rust 2021 TESTS 14 156 30412800

remove filters

Back to search problems