Codeforces Round 1123 (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
2267 Codeforces Round 1123 (Div. 2) FINISHED False 8100 833066 Sept. 25, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 14527 ) B Fashionable Array PROGRAMMING brute force constructive algorithms sortings

The mode of an array — is the number that appears the maximum number of times in the array. If several numbers appear the maximum number of times, the mode is the largest among them. For example, the mode of the array (1, 1, 2) is (1), and the mode of the array (3, 4) is (4). You are given an array (a) consisting of (n) integers. You may arbitrarily permute the numbers in array (a) in any order. Your task — is to rearrange the numbers in array (a) so that the sum of the modes over all prefixes of the array is maximized. For example, the array (2, 3, 2) can be rearranged as (3, 2, 2). Then the sum of the modes over all prefixes is determined as follows: The prefix of length (1) is (3). The mode of this prefix is (3). The prefix of length (2) is (3, 2). The mode of this prefix is (3). The prefix of length (3) is (3, 2, 2). The mode of this prefix is (2). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 500)). The description of the test cases follows. The first line of each test case contains one integer (n) ((1 \le n \le 100)) — the size of the array. The second line of each test case contains (n) integers (a_1, a_2, \ldots a_n) ((1 \le a_i \le 100)) — the elements of the array. For each test case, output a new array whose sum of the modes over all prefixes is maximal. If there are several optimal answers, output any of them. The first test case is described in the statement of the problem. In the second test case, one suitable arrangement is (4, 4, 3, 2, 1, 1). The mode of each prefix is (4). In the third test case, the arrangement (4, 1, 3, 2, 2) is a valid answer. The mode of each prefix: The prefix of length (1) is (4). The mode of this prefix is (4). The prefix of length (2) is (4, 1). The mode of this prefix is (4). The prefix of lengt

Tutorials

157126

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
392081390 RunninglVlan B Sept. 25, 2026, 6:35 p.m. OK C# 13 TESTS 5 937 5427200
392063864 kartheekdasari02 B Sept. 25, 2026, 4:30 p.m. OK C++17 (GCC 7-32) TESTS 5 15 0
392102168 kylin0610 B Sept. 26, 2026, 2:25 a.m. OK C++17 (GCC 7-32) TESTS 5 15 0
392094967 gleepglinky B Sept. 25, 2026, 11:20 p.m. OK C++17 (GCC 7-32) TESTS 5 15 0
392079597 wck_iipi B Sept. 25, 2026, 6:15 p.m. OK C++17 (GCC 7-32) TESTS 5 15 0
392072308 DivyanshG09 B Sept. 25, 2026, 5:08 p.m. OK C++17 (GCC 7-32) TESTS 5 15 0
392069088 undefinedderivativE B Sept. 25, 2026, 4:45 p.m. OK C++17 (GCC 7-32) TESTS 5 15 0
392068732 aadmyrj B Sept. 25, 2026, 4:44 p.m. OK C++17 (GCC 7-32) TESTS 5 15 0
392068720 ahmad.muhammadi.muhamad B Sept. 25, 2026, 4:44 p.m. OK C++17 (GCC 7-32) TESTS 5 15 0
392065386 codaron B Sept. 25, 2026, 4:35 p.m. OK C++17 (GCC 7-32) TESTS 5 15 0
392067084 RAR2004 B Sept. 25, 2026, 4:40 p.m. OK C++17 (GCC 7-32) TESTS 5 15 0
392077510 neoiiilo B Sept. 25, 2026, 5:53 p.m. OK C++20 (GCC 13-64) TESTS 5 15 0
392081420 himanshujhaa B Sept. 25, 2026, 6:35 p.m. OK C++20 (GCC 13-64) TESTS 5 15 0
392080374 3B3ATY B Sept. 25, 2026, 6:23 p.m. OK C++20 (GCC 13-64) TESTS 5 15 0
392080033 xjhanderX B Sept. 25, 2026, 6:19 p.m. OK C++20 (GCC 13-64) TESTS 5 15 0
392079885 PratinavGupta B Sept. 25, 2026, 6:18 p.m. OK C++20 (GCC 13-64) TESTS 5 15 0
392077485 Sabid_ B Sept. 25, 2026, 5:53 p.m. OK C++20 (GCC 13-64) TESTS 5 15 0
392075963 zycof B Sept. 25, 2026, 5:38 p.m. OK C++20 (GCC 13-64) TESTS 5 15 0
392074365 ar_paixaos19 B Sept. 25, 2026, 5:23 p.m. OK C++20 (GCC 13-64) TESTS 5 15 0
392074288 -Zoro- B Sept. 25, 2026, 5:23 p.m. OK C++20 (GCC 13-64) TESTS 5 15 0
392072989 OmarEmad B Sept. 25, 2026, 5:13 p.m. OK C++20 (GCC 13-64) TESTS 5 15 0
392079444 kavish2007 B Sept. 25, 2026, 6:13 p.m. OK C++23 (GCC 14-64, msys2) TESTS 5 0 0
392088303 chenmenken B Sept. 25, 2026, 8:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 5 15 0
392084551 Yahia__Ashraf B Sept. 25, 2026, 7:17 p.m. OK C++23 (GCC 14-64, msys2) TESTS 5 15 0
392109900 BaiCheng_ B Sept. 26, 2026, 4:59 a.m. OK C++23 (GCC 14-64, msys2) TESTS 5 15 0
392107430 Sangiiko B Sept. 26, 2026, 4:20 a.m. OK C++23 (GCC 14-64, msys2) TESTS 5 15 0
392102333 nighthowl1526 B Sept. 26, 2026, 2:29 a.m. OK C++23 (GCC 14-64, msys2) TESTS 5 15 0
392101901 Quiy B Sept. 26, 2026, 2:19 a.m. OK C++23 (GCC 14-64, msys2) TESTS 5 15 0
392099024 _CWD_ B Sept. 26, 2026, 1:07 a.m. OK C++23 (GCC 14-64, msys2) TESTS 5 15 0
392092964 chinmaylk99 B Sept. 25, 2026, 10:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 5 15 0
392088475 Nurex_001 B Sept. 25, 2026, 8:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 5 15 0
392065614 byom B Sept. 25, 2026, 4:35 p.m. OK GNU C11 TESTS 5 140 204800
392069759 Delther B Sept. 25, 2026, 4:47 p.m. OK GNU C11 TESTS 5 156 0
392089045 _dr.doom_ B Sept. 25, 2026, 8:31 p.m. OK GNU C11 TESTS 5 156 102400
392094862 wlbg B Sept. 25, 2026, 11:16 p.m. OK GNU C11 TESTS 5 156 102400
392082439 L.u_Z.o B Sept. 25, 2026, 6:48 p.m. OK GNU C11 TESTS 5 171 0
392061264 kr1th1k B Sept. 25, 2026, 4:23 p.m. OK GNU C11 TESTS 5 171 102400
392067113 Yang1220 B Sept. 25, 2026, 4:40 p.m. OK GNU C11 TESTS 5 171 102400
392094840 wlbg B Sept. 25, 2026, 11:15 p.m. OK GNU C11 TESTS 5 171 409600
392067642 ja1d3v_ B Sept. 25, 2026, 4:41 p.m. OK GNU C11 TESTS 5 187 0
392064053 kavyakaushal007 B Sept. 25, 2026, 4:31 p.m. OK GNU C11 TESTS 5 187 0
392063463 egrett B Sept. 25, 2026, 4:29 p.m. OK Go TESTS 5 171 4710400
392106680 silicalet B Sept. 26, 2026, 4:08 a.m. OK Haskell TESTS 5 62 102400
392067515 Hitesh_2005 B Sept. 25, 2026, 4:41 p.m. OK Java 21 TESTS 5 171 204800
392064667 GDragon247 B Sept. 25, 2026, 4:32 p.m. OK Java 21 TESTS 5 187 0
392059584 techbro815 B Sept. 25, 2026, 4:18 p.m. OK Java 21 TESTS 5 187 0
392061185 Abarna_t B Sept. 25, 2026, 4:22 p.m. OK Java 21 TESTS 5 187 409600
392058727 tanish1908 B Sept. 25, 2026, 4:16 p.m. OK Java 21 TESTS 5 187 819200
392064219 Raj_coder B Sept. 25, 2026, 4:31 p.m. OK Java 21 TESTS 5 187 921600
392059955 Pawan_IIIT_01 B Sept. 25, 2026, 4:19 p.m. OK Java 21 TESTS 5 203 0
392058725 codeTitanX B Sept. 25, 2026, 4:16 p.m. OK Java 21 TESTS 5 203 102400
392066197 Shreya_410 B Sept. 25, 2026, 4:37 p.m. OK Java 21 TESTS 5 203 204800
392063212 utkarsh130 B Sept. 25, 2026, 4:28 p.m. OK Java 21 TESTS 5 203 204800
392069286 Ayusharma17 B Sept. 25, 2026, 4:46 p.m. OK Java 8 TESTS 5 78 0
392062884 CodeLover2007 B Sept. 25, 2026, 4:27 p.m. OK Java 8 TESTS 5 140 0
392059153 KamilIskhakov B Sept. 25, 2026, 4:17 p.m. OK Java 8 TESTS 5 156 0
392061151 NGGamer B Sept. 25, 2026, 4:22 p.m. OK Java 8 TESTS 5 156 0
392060717 nabeelafatima256 B Sept. 25, 2026, 4:21 p.m. OK Java 8 TESTS 5 156 0
392111672 MACLOVER B Sept. 26, 2026, 5:21 a.m. OK Java 8 TESTS 5 171 0
392060164 Ramuramu9 B Sept. 25, 2026, 4:20 p.m. OK Java 8 TESTS 5 171 0
392061279 Kritarth_Teli B Sept. 25, 2026, 4:23 p.m. OK Java 8 TESTS 5 187 0
392060408 Aadiiiikkkkkk B Sept. 25, 2026, 4:20 p.m. OK Java 8 TESTS 5 187 0
392086635 Priyanshi_Vishwakarma B Sept. 25, 2026, 7:48 p.m. OK Java 8 TESTS 5 218 0
392075105 A_23 B Sept. 25, 2026, 5:30 p.m. OK Kotlin 2.2 TESTS 5 125 102400
392062108 dev.priyanshu B Sept. 25, 2026, 4:25 p.m. OK Node.js TESTS 5 93 3481600
392070118 malets2011 B Sept. 25, 2026, 4:48 p.m. OK PascalABC.NET TESTS 5 312 102400
392116107 reshuu_7 B Sept. 26, 2026, 5:59 a.m. OK PyPy 3 TESTS 5 140 7475200
392097675 mo-hit B Sept. 26, 2026, 12:38 a.m. OK PyPy 3 TESTS 5 203 8908800
392072966 a2e B Sept. 25, 2026, 5:12 p.m. OK PyPy 3-64 TESTS 5 78 2560000
392086722 sktb B Sept. 25, 2026, 7:50 p.m. OK PyPy 3-64 TESTS 5 78 2764800
392060298 xing_meng B Sept. 25, 2026, 4:20 p.m. OK PyPy 3-64 TESTS 5 78 3891200
392058218 ykarthik.1011 B Sept. 25, 2026, 4:14 p.m. OK PyPy 3-64 TESTS 5 78 4300800
392110602 sash070 B Sept. 26, 2026, 5:09 a.m. OK PyPy 3-64 TESTS 5 78 5632000
392061790 tujain B Sept. 25, 2026, 4:24 p.m. OK PyPy 3-64 TESTS 5 93 3993600
392073372 taranveersidhu302521 B Sept. 25, 2026, 5:15 p.m. OK PyPy 3-64 TESTS 5 93 4096000
392097335 benja_RGV B Sept. 26, 2026, 12:31 a.m. OK PyPy 3-64 TESTS 5 93 4198400
392077781 Xevon B Sept. 25, 2026, 5:56 p.m. OK PyPy 3-64 TESTS 5 93 4198400
392058521 pktdin0 B Sept. 25, 2026, 4:15 p.m. OK PyPy 3-64 TESTS 5 93 4198400
392067880 Synthexia B Sept. 25, 2026, 4:42 p.m. OK Python 3 TESTS 5 46 4403200
392116041 efanm B Sept. 26, 2026, 5:59 a.m. OK Python 3 TESTS 5 62 102400
392058729 nathan_benito B Sept. 25, 2026, 4:16 p.m. OK Python 3 TESTS 5 62 102400
392074931 Remedan_ B Sept. 25, 2026, 5:28 p.m. OK Python 3 TESTS 5 62 307200
392060966 huurichardho2008 B Sept. 25, 2026, 4:22 p.m. OK Python 3 TESTS 5 62 3174400
392059537 kridha_ms_24 B Sept. 25, 2026, 4:18 p.m. OK Python 3 TESTS 5 62 3174400
392067332 priyanshuok146 B Sept. 25, 2026, 4:40 p.m. OK Python 3 TESTS 5 62 3481600
392062187 avidipsarkar B Sept. 25, 2026, 4:25 p.m. OK Python 3 TESTS 5 62 4403200
392060517 rasram B Sept. 25, 2026, 4:21 p.m. OK Python 3 TESTS 5 78 0
392109313 ramlucky1999 B Sept. 26, 2026, 4:51 a.m. OK Python 3 TESTS 5 78 102400
392066285 chakrabanda B Sept. 25, 2026, 4:37 p.m. OK Rust 2021 TESTS 5 31 819200
392075305 m397 B Sept. 25, 2026, 5:32 p.m. OK Rust 2024 TESTS 5 15 102400
392067062 amanchourasia B Sept. 25, 2026, 4:39 p.m. OK Rust 2024 TESTS 5 15 512000
392077234 viveksahani39266 B Sept. 25, 2026, 5:51 p.m. OK Rust 2024 TESTS 5 15 2048000

remove filters

Back to search problems