Codeforces Round 1027 (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
2114 Codeforces Round 1027 (Div. 3) FINISHED False 8100 28135523 May 26, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 30766 ) C Need More Arrays PROGRAMMING greedy greedy greedy

Given an array (a) and (n) integers. It is sorted in non-decreasing order, that is, (a_i \le a_{i + 1}) for all (1 \le i < n). You can remove any number of elements from the array (including the option of not removing any at all) without changing the order of the remaining elements. After the removals, the following will occur: (a_1) is written to a new array; if (a_1 + 1 < a_2), then (a_2) is written to a new array; otherwise, (a_2) is written to the same array as (a_1); if (a_2 + 1 < a_3), then (a_3) is written to a new array; otherwise, (a_3) is written to the same array as (a_2); (\cdots) For example, if (a=1, 2, 4, 6), then: (a_1 = 1) is written to the new array, resulting in arrays: (1); (a_1 + 1 = 2), so (a_2 = 2) is added to the existing array, resulting in arrays: (1, 2); (a_2 + 1 = 3), so (a_3 = 4) is written to a new array, resulting in arrays: (1, 2) and (4); (a_3 + 1 = 5), so (a_4 = 6) is written to a new array, resulting in arrays: (1, 2), (4), and (6). Your task is to remove elements in such a way that the described algorithm creates as many arrays as possible. If you remove all elements from the array, no new arrays will be created. The first line of input contains one integer (t) ((1 \le t \le 10^4)) — the number of test cases. The first line of each test case contains one integer (n) ((1 \le n \le 2 \cdot 10^5)) — the length 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 10^6), (a_i \le a_{i + 1})) — the elements of the array. It is guaranteed that the sum of (n) across all test cases does not exceed (2 \cdot 10^5). For each test case, output one integer — the maximum number of arrays that can be obtained by removing any (possibly zero) number of elements. In the first example, you can remove (a_3) and $$

Tutorials

143268

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
321669288 ArslanAkhmadeev C May 27, 2025, 3:17 p.m. OK C++17 (GCC 7-32) TESTS 11 62 102400
321734252 Cavee C May 28, 2025, 5:30 a.m. OK C++17 (GCC 7-32) TESTS 11 77 0
321724364 inimad C May 28, 2025, 4:36 a.m. OK C++17 (GCC 7-32) TESTS 11 77 0
321721688 adityadebnath0202 C May 28, 2025, 3:58 a.m. OK C++17 (GCC 7-32) TESTS 11 77 0
321718782 orzthxuan C May 28, 2025, 3:10 a.m. OK C++17 (GCC 7-32) TESTS 11 77 0
321716394 Saelemaekers C May 28, 2025, 2:31 a.m. OK C++17 (GCC 7-32) TESTS 11 77 0
321703222 Shawn_das C May 27, 2025, 8:42 p.m. OK C++17 (GCC 7-32) TESTS 11 77 0
321701949 Y_BADR C May 27, 2025, 8:22 p.m. OK C++17 (GCC 7-32) TESTS 11 77 0
321691545 NKhanh106 C May 27, 2025, 6:18 p.m. OK C++17 (GCC 7-32) TESTS 11 77 0
321693065 SSShanuu C May 27, 2025, 6:33 p.m. OK C++17 (GCC 7-32) TESTS 11 77 0
321723201 theBook2008 C May 28, 2025, 4:20 a.m. OK C++20 (GCC 13-64) TESTS 11 61 0
321639671 Passerby. C May 27, 2025, 11:51 a.m. OK C++20 (GCC 13-64) TESTS 11 61 24064000
321672456 dark_lord_6969 C May 27, 2025, 3:41 p.m. OK C++20 (GCC 13-64) TESTS 11 62 0
321721352 Baseplate._. C May 28, 2025, 3:52 a.m. OK C++20 (GCC 13-64) TESTS 11 62 0
321716662 GrunRay C May 28, 2025, 2:36 a.m. OK C++20 (GCC 13-64) TESTS 11 62 0
321594915 Dan13llljws C May 27, 2025, 6:19 a.m. OK C++20 (GCC 13-64) TESTS 11 62 0
321718240 vpvpvpvvp C May 28, 2025, 3:02 a.m. OK C++20 (GCC 13-64) TESTS 11 62 102400
321720777 yunbless C May 28, 2025, 3:42 a.m. OK C++20 (GCC 13-64) TESTS 11 62 102400
321719947 Pika C May 28, 2025, 3:30 a.m. OK C++20 (GCC 13-64) TESTS 11 62 102400
321663523 Ayushanma C May 27, 2025, 2:35 p.m. OK C++20 (GCC 13-64) TESTS 11 62 102400
321673392 Parthib_Saha C May 27, 2025, 3:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 11 62 0
321726043 Lion_Heart C May 28, 2025, 4:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 11 62 0
321721564 Raven03 C May 28, 2025, 3:56 a.m. OK C++23 (GCC 14-64, msys2) TESTS 11 62 0
321721528 eliaukkk C May 28, 2025, 3:55 a.m. OK C++23 (GCC 14-64, msys2) TESTS 11 62 0
321721153 stack_69 C May 28, 2025, 3:49 a.m. OK C++23 (GCC 14-64, msys2) TESTS 11 62 0
321719382 Souture C May 28, 2025, 3:20 a.m. OK C++23 (GCC 14-64, msys2) TESTS 11 62 0
321715312 buxaingqiaodaima C May 28, 2025, 2:12 a.m. OK C++23 (GCC 14-64, msys2) TESTS 11 62 0
321667752 lazyflash99 C May 27, 2025, 3:06 p.m. OK C++23 (GCC 14-64, msys2) TESTS 11 62 0
321649284 0xBADBAD C May 27, 2025, 12:55 p.m. OK C++23 (GCC 14-64, msys2) TESTS 11 62 0
321642743 zzzssz C May 27, 2025, 12:12 p.m. OK C++23 (GCC 14-64, msys2) TESTS 11 62 0
321712558 bluemegane C May 28, 2025, 1:07 a.m. OK C# 8 TESTS 11 124 15769600
321591144 sampurna1416 C May 27, 2025, 5:46 a.m. OK GNU C11 TESTS 11 77 819200
321697479 Sayan007 C May 27, 2025, 7:23 p.m. OK GNU C11 TESTS 11 77 921600
321683210 Mridul_Garg C May 27, 2025, 5:05 p.m. OK GNU C11 TESTS 11 77 921600
321698508 alicia33 C May 27, 2025, 7:35 p.m. OK GNU C11 TESTS 11 93 819200
321706138 another_altacc C May 27, 2025, 9:42 p.m. OK GNU C11 TESTS 11 93 921600
321674448 conglingkaishi C May 27, 2025, 3:56 p.m. OK Go TESTS 11 1218 5222400
321674840 lyongwolf C May 27, 2025, 4 p.m. OK Java 21 TESTS 11 249 716800
321720633 bomakhamchha C May 28, 2025, 3:41 a.m. OK Java 21 TESTS 11 280 921600
321661326 shivashish C May 27, 2025, 2:19 p.m. OK Java 21 TESTS 11 280 1126400
321713194 2018331056shanto C May 28, 2025, 1:25 a.m. OK Java 21 TESTS 11 296 921600
321664198 Spencer1s C May 27, 2025, 2:40 p.m. OK Java 21 TESTS 11 296 1228800
321670721 tekka_ity C May 27, 2025, 3:28 p.m. OK Java 21 TESTS 11 311 1126400
321589728 ankitraj_129 C May 27, 2025, 5:33 a.m. OK Java 21 TESTS 11 312 716800
321663485 venkatesh7779 C May 27, 2025, 2:35 p.m. OK Java 21 TESTS 11 312 14438400
321677327 codes411 C May 27, 2025, 4:19 p.m. OK Java 21 TESTS 11 327 716800
321696740 jsonier C May 27, 2025, 7:14 p.m. OK Java 21 TESTS 11 342 3072000
321709851 Destroyer0069 C May 27, 2025, 11:35 p.m. OK Java 8 TESTS 11 156 0
321628082 Tharun_Reddy_ C May 27, 2025, 10:28 a.m. OK Java 8 TESTS 11 171 2764800
321667213 Sumitsingh7 C May 27, 2025, 3:02 p.m. OK Java 8 TESTS 11 171 6860800
321659878 satyams_9001 C May 27, 2025, 2:09 p.m. OK Java 8 TESTS 11 171 6860800
321690741 zhai123 C May 27, 2025, 6:10 p.m. OK Java 8 TESTS 11 187 2764800
321621513 Purav_Shah07 C May 27, 2025, 9:42 a.m. OK Java 8 TESTS 11 202 2867200
321695724 abhayrajnegi0416 C May 27, 2025, 7:02 p.m. OK Java 8 TESTS 11 202 4300800
321686250 Eslam_Ahmed C May 27, 2025, 5:31 p.m. OK Java 8 TESTS 11 280 22016000
321686067 NavneetKumar123 C May 27, 2025, 5:29 p.m. OK Java 8 TESTS 11 374 0
321657328 ABHIRAM2005 C May 27, 2025, 1:50 p.m. OK Java 8 TESTS 11 390 0
321600520 Calculuslove C May 27, 2025, 7:03 a.m. OK PyPy 3 TESTS 11 249 14643200
321633027 Leshka22 C May 27, 2025, 11:07 a.m. OK PyPy 3 TESTS 11 264 15155200
321631159 vermakunal088 C May 27, 2025, 10:52 a.m. OK PyPy 3 TESTS 11 280 14848000
321624460 sumitmandaliitr C May 27, 2025, 10:02 a.m. OK PyPy 3 TESTS 11 280 15564800
321674466 codsila C May 27, 2025, 3:57 p.m. OK PyPy 3 TESTS 11 281 15257600
321706467 khaoula-km C May 27, 2025, 9:51 p.m. OK PyPy 3 TESTS 11 312 15155200
321623765 _PD_ C May 27, 2025, 9:58 a.m. OK PyPy 3 TESTS 11 328 18944000
321630869 ResilientRose C May 27, 2025, 10:50 a.m. OK PyPy 3-64 TESTS 11 124 22016000
321625865 linhcooocaaa C May 27, 2025, 10:12 a.m. OK PyPy 3-64 TESTS 11 124 26214400
321681604 tassei903 C May 27, 2025, 4:52 p.m. OK PyPy 3-64 TESTS 11 139 28672000
321618750 _Aditya_Jain_ C May 27, 2025, 9:22 a.m. OK PyPy 3-64 TESTS 11 140 17203200
321709094 monocrap C May 27, 2025, 11:07 p.m. OK PyPy 3-64 TESTS 11 140 21811200
321586472 Baichuan C May 27, 2025, 5:05 a.m. OK PyPy 3-64 TESTS 11 140 26419200
321644146 Tz1934 C May 27, 2025, 12:22 p.m. OK PyPy 3-64 TESTS 11 140 26726400
321615707 Euler06 C May 27, 2025, 9:03 a.m. OK PyPy 3-64 TESTS 11 155 22323200
321720720 yiren429 C May 28, 2025, 3:42 a.m. OK PyPy 3-64 TESTS 11 155 25292800
321665061 aadi_0009 C May 27, 2025, 2:47 p.m. OK PyPy 3-64 TESTS 11 155 25292800
321702251 eugalt C May 27, 2025, 8:27 p.m. OK Python 3 TESTS 11 124 15360000
321640591 kaizerfsixteen C May 27, 2025, 11:57 a.m. OK Python 3 TESTS 11 124 24166400
321718332 andrewliu10523 C May 28, 2025, 3:03 a.m. OK Python 3 TESTS 11 125 21401600
321704920 dipak12.11 C May 27, 2025, 9:13 p.m. OK Python 3 TESTS 11 125 23654400
321587374 awesome_star C May 27, 2025, 5:14 a.m. OK Python 3 TESTS 11 140 23654400
321719280 abhiratha C May 28, 2025, 3:18 a.m. OK Python 3 TESTS 11 140 23756800
321717612 jayeuclid897 C May 28, 2025, 2:52 a.m. OK Python 3 TESTS 11 140 23756800
321703228 joako4913 C May 27, 2025, 8:43 p.m. OK Python 3 TESTS 11 140 23756800
321662468 UltraMate C May 27, 2025, 2:28 p.m. OK Python 3 TESTS 11 155 23859200
321649736 harry0018 C May 27, 2025, 12:58 p.m. OK Python 3 TESTS 11 156 23654400
321663061 UltramanDecker C May 27, 2025, 2:32 p.m. OK Rust 2021 TESTS 11 61 2560000
321669987 fujishu C May 27, 2025, 3:22 p.m. OK Rust 2021 TESTS 11 62 2764800
321650171 Ming_Xu C May 27, 2025, 1:01 p.m. OK Rust 2021 TESTS 11 77 4096000
321735274 axerel C May 28, 2025, 5:39 a.m. OK Rust 2021 TESTS 11 93 12083200
321639481 DanielAnker C May 27, 2025, 11:50 a.m. OK Rust 2021 TESTS 11 109 0

remove filters

Back to search problems