Codeforces Round 1058 (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
2160 Codeforces Round 1058 (Div. 2) FINISHED False 9000 16125923 Oct. 12, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 22342 ) A MEX Partition PROGRAMMING math

Let a partition of a multiset (B) be a collection of multisets (s_1, s_2,\ldots, s_k) such that each element appears the same number of times in (B) and across all of (s_1,s_2,\ldots,s_k). For example, some partitions of (\{1,2,3,3\}) include (\{1,3\}+\{2,3\}, \{1,2,3,3\}), and (\{2\}+\{1,3\}+\{3\}), but not (\{1,2\}+\{3\}). A partition is called valid if the (\operatorname{mex})(^{\text{∗}}) of all multisets in the partition is the same. The score of a valid partition is the (\operatorname{mex}) of any multiset in the partition. You are given a multiset (A) of size (n). Find the minimum score over all valid partitions of (A). (^{\text{∗}})The minimum excluded (MEX) of a collection of integers (c_1, c_2, \ldots, c_k) is defined as the smallest non-negative integer (x) which does not occur in the collection (c). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 100)). The description of the test cases follows. The first line of each test case contains an integer (n) ((1 \leq n \leq 100)). The second line contains (n) integers (A_1, A_2, \ldots, A_n) denoting the elements of (A) ((0 \leq A_i \leq 100)). It is not guaranteed that the elements are given in non-decreasing order. For each test case, output the minimum score over all valid partitions. In the first test case, the minimum score of (1) can be obtained by the partition (\{0\}+\{0\}+\{0\}). The partition is valid because each multiset has a (\operatorname{mex}) of (1), which is consequently the score of the partition. In the second test case, we can use (\{1,2\}) as the only multiset in the partition, which has (\operatorname{mex} 0).

Tutorials

Codeforces Round 1058 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
343646045 og.kostya A Oct. 14, 2025, 6 a.m. OK C# 10 TESTS 4 93 0
343646012 og.kostya A Oct. 14, 2025, 5:59 a.m. OK C# 13 TESTS 4 109 0
343585263 ah_ashik A Oct. 13, 2025, 5:32 p.m. OK C++17 (GCC 7-32) TESTS 4 30 0
343530641 smanov A Oct. 13, 2025, 12:52 p.m. OK C++17 (GCC 7-32) TESTS 4 30 0
343518853 public_server A Oct. 13, 2025, 11:44 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
343504427 seval_07 A Oct. 13, 2025, 9:59 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
343493818 _shivam__chaudhary A Oct. 13, 2025, 8:44 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
343486739 its2ru3 A Oct. 13, 2025, 7:54 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
343461962 CODING-- A Oct. 13, 2025, 4:25 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
343458654 jyotpratapsingh2000 A Oct. 13, 2025, 3:52 a.m. OK C++17 (GCC 7-32) TESTS 4 30 0
343440283 wbm A Oct. 12, 2025, 11:52 p.m. OK C++17 (GCC 7-32) TESTS 4 30 0
343424386 hustler101 A Oct. 12, 2025, 7:40 p.m. OK C++17 (GCC 7-32) TESTS 4 30 0
343646264 miss5 A Oct. 14, 2025, 6:02 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
343621441 YANGKM A Oct. 14, 2025, 1 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
343613779 tylolhot A Oct. 13, 2025, 9:34 p.m. OK C++20 (GCC 13-64) TESTS 4 30 0
343497855 Anamul_102 A Oct. 13, 2025, 9:11 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
343482638 Coel A Oct. 13, 2025, 7:24 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
343472449 wangyuxianWBWYX A Oct. 13, 2025, 6:08 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
343472134 wangyuxianWBWYX A Oct. 13, 2025, 6:05 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
343452590 NewGrandMaster A Oct. 13, 2025, 3:01 a.m. OK C++20 (GCC 13-64) TESTS 4 30 0
343429011 longago_06 A Oct. 12, 2025, 8:23 p.m. OK C++20 (GCC 13-64) TESTS 4 30 0
343425575 nabhya_p A Oct. 12, 2025, 7:50 p.m. OK C++20 (GCC 13-64) TESTS 4 30 0
343577268 its_bhavik7 A Oct. 13, 2025, 4:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
343568116 mehdiCS A Oct. 13, 2025, 3:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
343513843 -bear- A Oct. 13, 2025, 11:13 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
343503546 dhruvnagani A Oct. 13, 2025, 9:52 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
343498887 gurpreet_1509 A Oct. 13, 2025, 9:18 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
343446407 Engulf A Oct. 13, 2025, 2:05 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
343439649 Libowen2025 A Oct. 12, 2025, 11:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
343439321 Ak_m7uslim A Oct. 12, 2025, 11:23 p.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 0
343440587 lianghengfei A Oct. 13, 2025, 12:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 102400
343510617 Eryi A Oct. 13, 2025, 10:48 a.m. OK C++23 (GCC 14-64, msys2) TESTS 4 30 1638400
343555909 pinkiphogat317 A Oct. 13, 2025, 2:44 p.m. OK GNU C11 TESTS 4 15 102400
343523610 Asish_673 A Oct. 13, 2025, 12:13 p.m. OK GNU C11 TESTS 4 31 102400
343531544 Ransomed A Oct. 13, 2025, 12:56 p.m. OK GNU C11 TESTS 4 31 409600
343625695 asymptote314 A Oct. 14, 2025, 2:12 a.m. OK GNU C11 TESTS 4 46 102400
343599095 Md-Dipu A Oct. 13, 2025, 6:59 p.m. OK GNU C11 TESTS 4 46 102400
343435489 SOHAN2358 A Oct. 12, 2025, 9:52 p.m. OK GNU C11 TESTS 4 46 102400
343544644 enigmatic_coder_007 A Oct. 13, 2025, 1:46 p.m. OK GNU C11 TESTS 4 62 0
343546419 Prasad_2628 A Oct. 13, 2025, 1:56 p.m. OK GNU C11 TESTS 4 78 0
343529703 msmlkm A Oct. 13, 2025, 12:47 p.m. OK Go TESTS 4 62 921600
343592139 CodeXGod A Oct. 13, 2025, 6:14 p.m. OK Java 21 TESTS 4 171 204800
343431018 JohnCena_IIT_ROPAR A Oct. 12, 2025, 8:46 p.m. OK Java 21 TESTS 4 171 204800
343434173 bomakhamchha A Oct. 12, 2025, 9:29 p.m. OK Java 21 TESTS 4 171 512000
343508823 Saucyy A Oct. 13, 2025, 10:34 a.m. OK Java 21 TESTS 4 186 1638400
343428050 ...uni A Oct. 12, 2025, 8:14 p.m. OK Java 21 TESTS 4 202 0
343453545 harsh_pentakota A Oct. 13, 2025, 3:08 a.m. OK Java 21 TESTS 4 202 102400
343461457 Dew_Drunk A Oct. 13, 2025, 4:19 a.m. OK Java 21 TESTS 4 202 204800
343446022 Sagar_TH_29 A Oct. 13, 2025, 2 a.m. OK Java 21 TESTS 4 202 204800
343442465 gyjxn A Oct. 13, 2025, 12:52 a.m. OK Java 21 TESTS 4 202 1126400
343577042 traybug A Oct. 13, 2025, 4:42 p.m. OK Java 21 TESTS 4 202 1228800
343620077 newaz420 A Oct. 14, 2025, 12:25 a.m. OK Java 8 TESTS 4 139 0
343461095 lupunish A Oct. 13, 2025, 4:15 a.m. OK Java 8 TESTS 4 140 0
343445323 Shankzzz A Oct. 13, 2025, 1:51 a.m. OK Java 8 TESTS 4 140 0
343436301 T-error A Oct. 12, 2025, 10:08 p.m. OK Java 8 TESTS 4 140 0
343460197 akshita_0802 A Oct. 13, 2025, 4:07 a.m. OK Java 8 TESTS 4 155 0
343438251 prince_jain A Oct. 12, 2025, 10:54 p.m. OK Java 8 TESTS 4 155 0
343573153 naman_9045 A Oct. 13, 2025, 4:20 p.m. OK Java 8 TESTS 4 156 0
343523098 Aman_017 A Oct. 13, 2025, 12:09 p.m. OK Java 8 TESTS 4 156 0
343647421 kevin_0911 A Oct. 14, 2025, 6:13 a.m. OK Java 8 TESTS 4 171 0
343543409 Remas A Oct. 13, 2025, 1:39 p.m. OK Java 8 TESTS 4 171 0
343432281 VaHiX A Oct. 12, 2025, 9:02 p.m. OK Kotlin 2.2 TESTS 4 171 102400
343633856 banavathjayasri8157 A Oct. 14, 2025, 3:46 a.m. OK PyPy 3 TESTS 4 62 1433600
343632152 radoslav11 A Oct. 14, 2025, 3:28 a.m. OK PyPy 3 TESTS 4 77 1433600
343602736 lightningskipper A Oct. 13, 2025, 7:29 p.m. OK PyPy 3 TESTS 4 77 1433600
343619912 hando_Taiya A Oct. 14, 2025, 12:21 a.m. OK PyPy 3 TESTS 4 92 1433600
343512267 Abhinav4116 A Oct. 13, 2025, 11:01 a.m. OK PyPy 3 TESTS 4 93 1536000
343426141 itsDarsh A Oct. 12, 2025, 7:55 p.m. OK PyPy 3 TESTS 4 93 1536000
343512083 Abhinav4116 A Oct. 13, 2025, 10:59 a.m. OK PyPy 3 TESTS 4 108 1536000
343647359 advita05 A Oct. 14, 2025, 6:13 a.m. OK PyPy 3 TESTS 4 109 1433600
343541753 Itachi42O A Oct. 13, 2025, 1:30 p.m. OK PyPy 3 TESTS 4 124 1433600
343423735 klu2300080335 A Oct. 12, 2025, 7:36 p.m. OK PyPy 3-64 TESTS 4 62 1331200
343644943 pranjay_sidhwani A Oct. 14, 2025, 5:49 a.m. OK PyPy 3-64 TESTS 4 62 1433600
343619103 RobinFromTheHood A Oct. 13, 2025, 11:54 p.m. OK PyPy 3-64 TESTS 4 62 1433600
343505025 shahedazeem2811 A Oct. 13, 2025, 10:04 a.m. OK PyPy 3-64 TESTS 4 62 1433600
343431603 SumitKundu A Oct. 12, 2025, 8:53 p.m. OK PyPy 3-64 TESTS 4 62 1433600
343439798 ehdnjs14 A Oct. 12, 2025, 11:36 p.m. OK PyPy 3-64 TESTS 4 77 1331200
343596634 mawo78 A Oct. 13, 2025, 6:41 p.m. OK PyPy 3-64 TESTS 4 77 1433600
343590525 SkyHigh007 A Oct. 13, 2025, 6:04 p.m. OK PyPy 3-64 TESTS 4 77 1433600
343589944 ashwaththama A Oct. 13, 2025, 6 p.m. OK PyPy 3-64 TESTS 4 77 1433600
343586327 Hars17hith A Oct. 13, 2025, 5:39 p.m. OK PyPy 3-64 TESTS 4 77 1433600
343602178 XGptw A Oct. 13, 2025, 7:24 p.m. OK Python 3 TESTS 4 46 0
343576810 ankitbodh5 A Oct. 13, 2025, 4:41 p.m. OK Python 3 TESTS 4 46 0
343450387 renn27 A Oct. 13, 2025, 2:43 a.m. OK Python 3 TESTS 4 46 0
343444097 sakib09q A Oct. 13, 2025, 1:27 a.m. OK Python 3 TESTS 4 46 0
343598443 yashnema52 A Oct. 13, 2025, 6:54 p.m. OK Python 3 TESTS 4 61 0
343590536 ANKUSH733 A Oct. 13, 2025, 6:04 p.m. OK Python 3 TESTS 4 61 0
343570303 grind1912 A Oct. 13, 2025, 4:03 p.m. OK Python 3 TESTS 4 61 0
343509536 nishitdua25 A Oct. 13, 2025, 10:39 a.m. OK Python 3 TESTS 4 61 0
343491975 RodrigoHernandezCascante A Oct. 13, 2025, 8:30 a.m. OK Python 3 TESTS 4 61 0
343468997 ponnagantitulasiram A Oct. 13, 2025, 5:39 a.m. OK Python 3 TESTS 4 61 0
343431096 bor2com A Oct. 12, 2025, 8:47 p.m. OK Rust 2021 TESTS 4 61 0
343477496 gnull A Oct. 13, 2025, 6:46 a.m. OK Rust 2024 TESTS 4 31 0
343437297 JustAndreyka A Oct. 12, 2025, 10:31 p.m. OK Rust 2024 TESTS 4 46 0
343470727 fr0st A Oct. 13, 2025, 5:53 a.m. OK Rust 2024 TESTS 4 46 102400

remove filters

Back to search problems