Codeforces Round 1074 (Div. 4)

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
2185 Codeforces Round 1074 (Div. 4) FINISHED False 8100 7658723 Jan. 18, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 3233 ) G Mixing MEXes PROGRAMMING data structures implementation math

You are given (n) arrays (a_1, a_2, \ldots, a_n). The following operation is performed exactly once: Choose any array among (a_1, a_2, \ldots, a_n). Suppose you've chosen array (a_i) ((1 \leq i \leq n)). Choose any element in array (a_i). Suppose you've chosen the (j)-th element of (a_i), denoted by (a_{i,j}) ((1 \leq j \leq |a_i|), where (|a_i|) denotes the length of array (a_i)). Choose any other array among (a_1, a_2, \ldots a_n) that is not (a_i) . Suppose you've chosen (a_k) ((1 \leq k \leq n, k \neq i)). Add (a_{i,j}) to the back of array (a_k). Then, remove (a_{i,j}) from (a_i). The value of this operation ((i,j,k)) is defined as the sum of each array's (\operatorname{MEX}) after the operation is performed. More formally, the value of an operation after the operation is performed is (\sum_{i=1} ^{n} \operatorname{MEX}(a_i)). Evaluate the sum of the values of all possible distinct independent operations. Two operations are distinct if the ordered triple of integers ((i,j,k)) is different. (\operatorname{MEX}(a)) is defined as the smallest non-negative integer that is not present in the array. For example, (\operatorname{MEX}(1, 2, 0, 5)) is (3), and (\operatorname{MEX}(1, 2, 4, 9)) is (0). The first line of the input contains a single integer (t) ((1 \leq t \leq 10^4)) — the number of test cases. The first line of each test case contains a single integer (n) ((2 \le n \le 2 \cdot 10^5)) — the number of arrays. The next (n) lines start with (l_i) ((1 \le l_i \le 10^5)) — the length of the (i)th array — then contain (l_i) integers (a_1, a_2, \ldots, a_{l_i}) ((0 \le a_{i_j} \le 10^6)) — the array (a_i). It is guaranteed that the sum of (l_i) over all test cases does not exceed (2 \cdot 10^5). For each test case, output the sum of the values of all possible distinct operations. Fo

Tutorials

Codeforces Round 1074 (Div. 4) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
358629696 silent_askly G Jan. 18, 2026, 4:42 p.m. OK C++17 (GCC 7-32) TESTS 16 78 18432000
358676716 undev G Jan. 19, 2026, 4:16 a.m. OK C++17 (GCC 7-32) TESTS 16 93 5017600
358631051 Ishan1923 G Jan. 18, 2026, 4:44 p.m. OK C++17 (GCC 7-32) TESTS 16 93 5734400
358631114 launcher_bomb_mini G Jan. 18, 2026, 4:44 p.m. OK C++17 (GCC 7-32) TESTS 16 93 6656000
358629578 notfil G Jan. 18, 2026, 4:42 p.m. OK C++17 (GCC 7-32) TESTS 16 93 9113600
358678609 Banis G Jan. 19, 2026, 4:44 a.m. OK C++17 (GCC 7-32) TESTS 16 93 14028800
358652570 Harigton G Jan. 18, 2026, 7:08 p.m. OK C++17 (GCC 7-32) TESTS 16 109 3481600
358635325 Maxgush G Jan. 18, 2026, 4:49 p.m. OK C++17 (GCC 7-32) TESTS 16 109 5120000
358629510 Burner01 G Jan. 18, 2026, 4:42 p.m. OK C++17 (GCC 7-32) TESTS 16 109 9830400
358658120 kur G Jan. 18, 2026, 8:35 p.m. OK C++17 (GCC 7-32) TESTS 16 109 44134400
358636381 KidusHawoltu G Jan. 18, 2026, 4:54 p.m. OK C++20 (GCC 13-64) TESTS 16 78 10854400
358653746 noxious_tab G Jan. 18, 2026, 7:24 p.m. OK C++20 (GCC 13-64) TESTS 16 93 4096000
358647043 accord G Jan. 18, 2026, 6:09 p.m. OK C++20 (GCC 13-64) TESTS 16 93 4505600
358636278 Teeleu G Jan. 18, 2026, 4:53 p.m. OK C++20 (GCC 13-64) TESTS 16 93 4608000
358631842 _Kee G Jan. 18, 2026, 4:45 p.m. OK C++20 (GCC 13-64) TESTS 16 93 6144000
358645401 rcd G Jan. 18, 2026, 5:55 p.m. OK C++20 (GCC 13-64) TESTS 16 93 6144000
358630978 Alosza G Jan. 18, 2026, 4:44 p.m. OK C++20 (GCC 13-64) TESTS 16 93 7680000
358630359 tophhh G Jan. 18, 2026, 4:43 p.m. OK C++20 (GCC 13-64) TESTS 16 93 8499200
358677887 CReatiQ G Jan. 19, 2026, 4:34 a.m. OK C++20 (GCC 13-64) TESTS 16 93 13824000
358632146 Mahmud_Saikat G Jan. 18, 2026, 4:45 p.m. OK C++20 (GCC 13-64) TESTS 16 93 34201600
358630919 v1p3r_jr G Jan. 18, 2026, 4:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 78 6246400
358654863 EduardoBrito G Jan. 18, 2026, 7:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 78 7884800
358637792 mcncheesee G Jan. 18, 2026, 5:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 78 17408000
358664705 harshitgrover G Jan. 18, 2026, 11:54 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 78 20787200
358650238 MvKaio G Jan. 18, 2026, 6:41 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 78 23961600
358646739 WilliamFung G Jan. 18, 2026, 6:06 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 93 6246400
358634227 Orijinxx G Jan. 18, 2026, 4:48 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 93 6246400
358646542 Ilham652 G Jan. 18, 2026, 6:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 93 6348800
358641858 -CHUNU- G Jan. 18, 2026, 5:28 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 93 7782400
358636604 khba G Jan. 18, 2026, 4:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 93 9420800
358635688 hollow_knight_27 G Jan. 18, 2026, 4:49 p.m. OK C# 8 TESTS 16 171 17612800
358638001 AbsurdMan G Jan. 18, 2026, 5:03 p.m. OK Go TESTS 16 171 58777600
358633540 monishajr2212 G Jan. 18, 2026, 4:47 p.m. OK Java 21 TESTS 16 312 6246400
358651164 Azad_Singh G Jan. 18, 2026, 6:51 p.m. OK Java 21 TESTS 16 328 26316800
358632778 xmjlove G Jan. 18, 2026, 4:46 p.m. OK Java 21 TESTS 16 375 19763200
358651759 Yousef_Badr G Jan. 18, 2026, 6:58 p.m. OK Java 21 TESTS 16 390 14950400
358661457 vineetiwari G Jan. 18, 2026, 9:50 p.m. OK Java 21 TESTS 16 453 12492800
358640157 puriabhijit000 G Jan. 18, 2026, 5:16 p.m. OK Java 21 TESTS 16 640 63385600
358633844 davidpascual G Jan. 18, 2026, 4:47 p.m. OK Java 21 TESTS 16 718 5529600
358630465 DSY23 G Jan. 18, 2026, 4:43 p.m. OK PyPy 3 TESTS 16 765 94208000
358683456 MihailLoginov G Jan. 19, 2026, 5:37 a.m. OK PyPy 3 TESTS 16 968 49868800
358639157 shaurya...1010 G Jan. 18, 2026, 5:10 p.m. OK PyPy 3-64 TESTS 16 156 49459200
358658065 kaushik.atla G Jan. 18, 2026, 8:34 p.m. OK PyPy 3-64 TESTS 16 187 56422400
358662089 Polynomu G Jan. 18, 2026, 10:10 p.m. OK PyPy 3-64 TESTS 16 218 24883200
358639655 eugenekoran G Jan. 18, 2026, 5:13 p.m. OK PyPy 3-64 TESTS 16 218 55091200
358629277 TpratimAewari G Jan. 18, 2026, 4:41 p.m. OK PyPy 3-64 TESTS 16 218 63897600
358633835 AdTerram G Jan. 18, 2026, 4:47 p.m. OK PyPy 3-64 TESTS 16 250 39219200
358640064 eugenekoran G Jan. 18, 2026, 5:16 p.m. OK PyPy 3-64 TESTS 16 312 55193600
358632240 KAMITO G Jan. 18, 2026, 4:45 p.m. OK PyPy 3-64 TESTS 16 328 106905600
358680535 chierin G Jan. 19, 2026, 5:07 a.m. OK PyPy 3-64 TESTS 16 406 102604800
358674133 eugenechka.boyko.2_0-0 G Jan. 19, 2026, 3:36 a.m. OK PyPy 3-64 TESTS 16 421 57344000
358630712 judeAio G Jan. 18, 2026, 4:43 p.m. OK Python 3 TESTS 16 375 26726400
358635666 Coder_Ayush_ G Jan. 18, 2026, 4:49 p.m. OK Python 3 TESTS 16 406 26112000
358640322 iamthe_orm G Jan. 18, 2026, 5:18 p.m. OK Python 3 TESTS 16 609 31744000
358661351 yesh1212 G Jan. 18, 2026, 9:47 p.m. OK Python 3 TESTS 16 687 19968000
358633034 Its_wasik G Jan. 18, 2026, 4:46 p.m. OK Python 3 TESTS 16 859 73625600
358662568 MutedSolace G Jan. 18, 2026, 10:26 p.m. OK Python 3 TESTS 16 875 137113600

remove filters

Back to search problems