Codeforces Round 1029 (Div. 3)

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
2117 Codeforces Round 1029 (Div. 3) FINISHED False 8100 27012323 June 8, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 20952 ) C Cool Partition PROGRAMMING data structures greedy

Yousef has an array (a) of size (n). He wants to partition the array into one or more contiguous segments such that each element (a_i) belongs to exactly one segment. A partition is called cool if, for every segment (b_j), all elements in (b_j) also appear in (b_{j + 1}) (if it exists). That is, every element in a segment must also be present in the segment following it. For example, if (a = 1, 2, 2, 3, 1, 5), a cool partition Yousef can make is (b_1 = 1, 2), (b_2 = 2, 3, 1, 5). This is a cool partition because every element in (b_1) (which are (1) and (2)) also appears in (b_2). In contrast, (b_1 = 1, 2, 2), (b_2 = 3, 1, 5) is not a cool partition, since (2) appears in (b_1) but not in (b_2). Note that after partitioning the array, you do not change the order of the segments. Also, note that if an element appears several times in some segment (b_j), it only needs to appear at least once in (b_{j + 1}). Your task is to help Yousef by finding the maximum number of segments that make a cool partition. The first line of the input contains integer (t) ((1 \le t \le 10^4)) — the number of test cases. The first line of each test case contains an integer (n) ((1 \le n \le 2 \cdot 10^5)) — the size of the array. The second line of each test case contains (n) integers (a_1, a_2, \dots, a_n) ((1 \le a_i \le n)) — the elements of the array. It is guaranteed that the sum of (n) over all test cases doesn't exceed (2 \cdot 10^5). For each test case, print one integer — the maximum number of segments that make a cool partition. The first test case is explained in the statement. We can partition it into (b_1 = 1, 2), (b_2 = 2, 3, 1, 5). It can be shown there is no other partition with more segments. In the second test case, we can partition the array into (b_1 = 1, 2), (b_2 = 1, 3, 2), (b_3 = 1, 3, 2). The maximum numb

Tutorials

Codeforces Round 1029 (Div. 3) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
323658744 vivekrajsundar C June 9, 2025, 3:48 p.m. OK C# 10 TESTS 39 140 18636800
323713488 og.kostya C June 10, 2025, 5:13 a.m. OK C# 13 TESTS 40 156 21504000
323712677 coderella C June 10, 2025, 5:04 a.m. OK C++17 (GCC 7-32) TESTS 40 93 102400
323633665 cinnabon14 C June 9, 2025, 12:40 p.m. OK C++17 (GCC 7-32) TESTS 39 93 102400
323610664 Pumkinhead_Me C June 9, 2025, 9:49 a.m. OK C++17 (GCC 7-32) TESTS 39 93 102400
323669583 mohitrajpoot C June 9, 2025, 5:13 p.m. OK C++17 (GCC 7-32) TESTS 39 93 307200
323674219 SwordGod C June 9, 2025, 5:52 p.m. OK C++17 (GCC 7-32) TESTS 39 93 409600
323716748 Sentry_49 C June 10, 2025, 5:49 a.m. OK C++17 (GCC 7-32) TESTS 40 93 1126400
323646345 j.ansul C June 9, 2025, 2:12 p.m. OK C++17 (GCC 7-32) TESTS 39 93 1126400
323706390 Hssaan_SundarSTEM C June 10, 2025, 3:39 a.m. OK C++17 (GCC 7-32) TESTS 40 93 2048000
323629886 DivuKhairha C June 9, 2025, 12:13 p.m. OK C++17 (GCC 7-32) TESTS 39 93 3174400
323665702 nirbhaykck C June 9, 2025, 4:43 p.m. OK C++17 (GCC 7-32) TESTS 39 93 3686400
323686058 neel27 C June 9, 2025, 7:57 p.m. OK C++20 (GCC 13-64) TESTS 40 78 102400
323618285 kaks_30 C June 9, 2025, 10:43 a.m. OK C++20 (GCC 13-64) TESTS 39 78 102400
323622469 Xx_star C June 9, 2025, 11:16 a.m. OK C++20 (GCC 13-64) TESTS 39 78 2252800
323715710 WAcrazier C June 10, 2025, 5:38 a.m. OK C++20 (GCC 13-64) TESTS 40 93 102400
323679267 PREMM_DESAI C June 9, 2025, 6:35 p.m. OK C++20 (GCC 13-64) TESTS 40 93 102400
323677971 mr_warlock C June 9, 2025, 6:25 p.m. OK C++20 (GCC 13-64) TESTS 40 93 102400
323655201 Khaled_14 C June 9, 2025, 3:19 p.m. OK C++20 (GCC 13-64) TESTS 39 93 102400
323654602 awooba C June 9, 2025, 3:14 p.m. OK C++20 (GCC 13-64) TESTS 39 93 102400
323617499 ylb_Ac2003 C June 9, 2025, 10:37 a.m. OK C++20 (GCC 13-64) TESTS 39 93 102400
323616701 ajaybir_iitp28 C June 9, 2025, 10:30 a.m. OK C++20 (GCC 13-64) TESTS 39 93 102400
323709545 shankhadeepg444 C June 10, 2025, 4:22 a.m. OK C++23 (GCC 14-64, msys2) TESTS 40 77 102400
323704136 _clint C June 10, 2025, 3:04 a.m. OK C++23 (GCC 14-64, msys2) TESTS 40 77 102400
323704489 TianTianChaoFangDe C June 10, 2025, 3:10 a.m. OK C++23 (GCC 14-64, msys2) TESTS 40 78 102400
323648130 chumeng C June 9, 2025, 2:26 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 78 102400
323632911 hshhh_ C June 9, 2025, 12:34 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 78 102400
323625560 Vcoistnt C June 9, 2025, 11:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 39 78 2867200
323640746 animesh159 C June 9, 2025, 1:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 93 0
323630492 7_divided_by_3 C June 9, 2025, 12:17 p.m. OK C++23 (GCC 14-64, msys2) TESTS 39 93 0
323715649 yxfql C June 10, 2025, 5:37 a.m. OK C++23 (GCC 14-64, msys2) TESTS 40 93 102400
323708567 Rajbir_2565 C June 10, 2025, 4:09 a.m. OK C++23 (GCC 14-64, msys2) TESTS 40 93 102400
323651593 suchendra C June 9, 2025, 2:50 p.m. OK GNU C11 TESTS 39 93 3276800
323643220 dwbh21 C June 9, 2025, 1:49 p.m. OK Java 21 TESTS 39 312 1228800
323604908 HarhsSoni C June 9, 2025, 9:08 a.m. OK Java 21 TESTS 39 343 17408000
323606317 bomakhamchha C June 9, 2025, 9:18 a.m. OK Java 21 TESTS 39 358 9523200
323650578 udaygupta8899 C June 9, 2025, 2:43 p.m. OK Java 21 TESTS 39 359 9523200
323616097 shivansh_123 C June 9, 2025, 10:26 a.m. OK Java 21 TESTS 39 389 22528000
323641409 sahil_14 C June 9, 2025, 1:35 p.m. OK Java 21 TESTS 39 390 16179200
323607810 HarhsSoni C June 9, 2025, 9:27 a.m. OK Java 21 TESTS 39 390 16998400
323641794 Aryaman__001 C June 9, 2025, 1:38 p.m. OK Java 21 TESTS 39 390 17715200
323664642 sarthakkharka808 C June 9, 2025, 4:35 p.m. OK Java 21 TESTS 39 390 19353600
323637512 dancingNigga2 C June 9, 2025, 1:07 p.m. OK Java 21 TESTS 39 390 22835200
323623706 NischayCodes C June 9, 2025, 11:26 a.m. OK Java 8 TESTS 39 280 12390400
323682172 kasiru_69 C June 9, 2025, 7:07 p.m. OK Java 8 TESTS 40 374 31744000
323625529 _Edith_ C June 9, 2025, 11:39 a.m. OK Java 8 TESTS 39 452 0
323707228 naman_9045 C June 10, 2025, 3:51 a.m. OK Java 8 TESTS 40 484 15462400
323604766 skk_codes C June 9, 2025, 9:08 a.m. OK Java 8 TESTS 39 499 11878400
323661438 pratapsinghnikhil757 C June 9, 2025, 4:10 p.m. OK Java 8 TESTS 39 499 15462400
323612455 Kuldeep_garg C June 9, 2025, 10:01 a.m. OK Java 8 TESTS 39 499 15667200
323627957 priyanshu3003 C June 9, 2025, 11:58 a.m. OK Java 8 TESTS 39 515 15564800
323688665 Sumitsingh7 C June 9, 2025, 8:38 p.m. OK Java 8 TESTS 40 515 44646400
323684596 satyams_9001 C June 9, 2025, 7:37 p.m. OK Java 8 TESTS 40 515 44646400
323655694 chinesedfan C June 9, 2025, 3:23 p.m. OK Node.js TESTS 39 281 91750400
323670717 sambodhi7 C June 9, 2025, 5:23 p.m. OK PyPy 3 TESTS 39 343 18227200
323655120 santhoshsparky123 C June 9, 2025, 3:19 p.m. OK PyPy 3 TESTS 39 436 30822400
323625096 Ryan_10744 C June 9, 2025, 11:36 a.m. OK PyPy 3 TESTS 39 452 24166400
323619144 DSKroc C June 9, 2025, 10:50 a.m. OK PyPy 3 TESTS 39 468 25088000
323716149 Mischievius C June 10, 2025, 5:43 a.m. OK PyPy 3-64 TESTS 40 156 19353600
323679951 Dastanbekov C June 9, 2025, 6:42 p.m. OK PyPy 3-64 TESTS 40 156 26316800
323615520 fractum_locum C June 9, 2025, 10:21 a.m. OK PyPy 3-64 TESTS 39 156 26316800
323652520 kamio-misuzu C June 9, 2025, 2:57 p.m. OK PyPy 3-64 TESTS 39 156 28569600
323616622 DivyamAwasthy C June 9, 2025, 10:30 a.m. OK PyPy 3-64 TESTS 39 171 25600000
323680050 Dastanbekov C June 9, 2025, 6:43 p.m. OK PyPy 3-64 TESTS 40 171 26009600
323671966 bigboi069 C June 9, 2025, 5:33 p.m. OK PyPy 3-64 TESTS 39 171 28467200
323697673 Touken C June 10, 2025, 12:52 a.m. OK PyPy 3-64 TESTS 40 171 153804800
323652153 kamio-misuzu C June 9, 2025, 2:54 p.m. OK PyPy 3-64 TESTS 39 186 28262400
323681949 Deecey01 C June 9, 2025, 7:04 p.m. OK PyPy 3-64 TESTS 40 187 27852800
323669557 sh.4teen C June 9, 2025, 5:13 p.m. OK Python 3 TESTS 39 187 32870400
323678845 Chuba C June 9, 2025, 6:32 p.m. OK Python 3 TESTS 40 202 23859200
323665934 347586774 C June 9, 2025, 4:45 p.m. OK Python 3 TESTS 39 202 30412800
323664814 adelgooglagel C June 9, 2025, 4:37 p.m. OK Python 3 TESTS 39 203 34099200
323640997 chierin C June 9, 2025, 1:32 p.m. OK Python 3 TESTS 39 218 23859200
323676709 harshitha_09 C June 9, 2025, 6:14 p.m. OK Python 3 TESTS 39 218 23961600
323667014 347586774 C June 9, 2025, 4:53 p.m. OK Python 3 TESTS 39 218 34099200
323658664 nirupamatiitd C June 9, 2025, 3:47 p.m. OK Python 3 TESTS 39 233 23449600
323629307 shanks_jr10 C June 9, 2025, 12:08 p.m. OK Python 3 TESTS 39 233 23756800
323611703 ___a_s_1_2___ C June 9, 2025, 9:56 a.m. OK Python 3 TESTS 39 234 23654400
323706476 acitrus C June 10, 2025, 3:40 a.m. OK Rust 2021 TESTS 40 77 2355200
323712851 acitrus C June 10, 2025, 5:06 a.m. OK Rust 2021 TESTS 40 77 2457600
323703849 acitrus C June 10, 2025, 2:59 a.m. OK Rust 2021 TESTS 40 77 2457600
323704303 acitrus C June 10, 2025, 3:07 a.m. OK Rust 2021 TESTS 40 77 5632000
323704174 acitrus C June 10, 2025, 3:04 a.m. OK Rust 2021 TESTS 40 93 5632000
323653218 cinkozzz C June 9, 2025, 3:03 p.m. OK Rust 2021 TESTS 39 93 10854400
323697671 Xeramian C June 10, 2025, 12:52 a.m. OK Rust 2021 TESTS 40 108 16793600
323712334 acitrus C June 10, 2025, 5:01 a.m. OK Rust 2021 TESTS 40 109 15257600
323712663 acitrus C June 10, 2025, 5:04 a.m. OK Rust 2021 TESTS 40 156 12492800
323690868 PlaceOrientedProgrammer C June 9, 2025, 9:21 p.m. OK Rust 2021 TESTS 40 264 9318400

remove filters

Back to search problems