Squarepoint Challenge (Codeforces Round 1055, Div. 1 + 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
2152 Squarepoint Challenge (Codeforces Round 1055, Div. 1 + Div. 2) FINISHED False 10800 16903523 Oct. 3, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 12091 ) C Triple Removal PROGRAMMING data structures greedy math

Tired of supporting ranged carries, Keria is now creating a data structure problem about supporting range queries. For an array (b = b_1, b_2, \ldots, b_m) of length (m) where (b_i=0) or (b_i=1), consider the following triple removal operation: Choose three indices (1 \le i < j < k \le m) such that the elements at these positions are identical ((b_i = b_j = b_k)). Remove these three elements from the array. The cost of this operation is defined as (\min(k-j, j-i)). After the removal, the remaining parts of the array are concatenated, and their indices are relabeled. We want to make the array (b) empty using the triple removal operation. Hence, we define the total cost of an array as the minimum possible sum of the costs of triple removal operations required to make the array empty. If it is impossible to make the array empty, the cost is defined to be (-1). Keria wants to test his data structure. For this, you must answer (q) independent queries. Initially, you are given an array (a = a_1, a_2, \ldots, a_n) of length (n) where (a_i=0) or (a_i=1). For each query, you are given a range (1 \le l \le r \le n) and must find the cost for the array (a_l, a_{l+1}, \ldots, a_r). Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains two integers (n) and (q) ((1 \le n, q \le 250\,000)) — the length of the array and the number of queries. The next line contains (n) integers (a_1, a_2, \ldots, a_n) ((a_i = 0) or (a_i=1)) — the elements of the array. Then (q) lines follow. The (i)-th of them contains two integers (l_i) and (r_i) ((1 \le l_i \le r_i \le n)) — the range of the subarray for the (i)-th query. It is guaranteed that the sum of (n) over all test cases does not exceed (250\,000). It

Tutorials

Squarepoint Challenge (Codeforces Round 1055, Div. 1 + Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
341774125 marscheng C Oct. 4, 2025, 2:58 a.m. OK C++17 (GCC 7-32) TESTS 20 93 5120000
341735133 hawk-kun C Oct. 3, 2025, 5:26 p.m. OK C++17 (GCC 7-32) TESTS 20 187 102400
341780724 guywholovesrandomness C Oct. 4, 2025, 4:26 a.m. OK C++17 (GCC 7-32) TESTS 20 202 0
341743244 yanlikun C Oct. 3, 2025, 6:31 p.m. OK C++17 (GCC 7-32) TESTS 20 202 3072000
341777437 NoDrug C Oct. 4, 2025, 3:42 a.m. OK C++17 (GCC 7-32) TESTS 20 202 3993600
341788943 Abhishek_2025 C Oct. 4, 2025, 5:55 a.m. OK C++17 (GCC 7-32) TESTS 20 203 0
341784025 Kartik_Y22 C Oct. 4, 2025, 5:09 a.m. OK C++17 (GCC 7-32) TESTS 20 203 0
341773239 herly C Oct. 4, 2025, 2:46 a.m. OK C++17 (GCC 7-32) TESTS 20 203 4812800
341756547 pro_player C Oct. 3, 2025, 8:39 p.m. OK C++17 (GCC 7-32) TESTS 20 217 0
341778455 Manish_shyoran7340 C Oct. 4, 2025, 3:58 a.m. OK C++17 (GCC 7-32) TESTS 20 217 5017600
341780742 -.--..-..... C Oct. 4, 2025, 4:27 a.m. OK C++20 (GCC 13-64) TESTS 20 171 0
341754849 casualcoder_310305 C Oct. 3, 2025, 8:18 p.m. OK C++20 (GCC 13-64) TESTS 20 171 0
341775668 jalor C Oct. 4, 2025, 3:19 a.m. OK C++20 (GCC 13-64) TESTS 20 171 102400
341763642 blue520 C Oct. 3, 2025, 11:11 p.m. OK C++20 (GCC 13-64) TESTS 20 171 102400
341757938 Carmel_Ab1 C Oct. 3, 2025, 8:58 p.m. OK C++20 (GCC 13-64) TESTS 20 171 102400
341778419 limits08 C Oct. 4, 2025, 3:57 a.m. OK C++20 (GCC 13-64) TESTS 20 171 204800
341756855 Vikas_Yadav104 C Oct. 3, 2025, 8:43 p.m. OK C++20 (GCC 13-64) TESTS 20 171 204800
341786189 jeevi_567 C Oct. 4, 2025, 5:31 a.m. OK C++20 (GCC 13-64) TESTS 20 171 1228800
341784387 zokz C Oct. 4, 2025, 5:14 a.m. OK C++20 (GCC 13-64) TESTS 20 171 2150400
341758192 Ayush_kes C Oct. 3, 2025, 9:02 p.m. OK C++20 (GCC 13-64) TESTS 20 171 2150400
341724354 ZaleClover C Oct. 3, 2025, 4:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 139 7065600
341784224 AloneInLoops C Oct. 4, 2025, 5:12 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 0
341773278 keye C Oct. 4, 2025, 2:47 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 0
341773757 yuyuan567 C Oct. 4, 2025, 2:53 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 204800
341770076 FakeDuck C Oct. 4, 2025, 1:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 307200
341772982 Benq C Oct. 4, 2025, 2:43 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 409600
341775270 Mrqx C Oct. 4, 2025, 3:13 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 1228800
341777424 LenmoChicken C Oct. 4, 2025, 3:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 4300800
341770001 a18404955649 C Oct. 4, 2025, 1:56 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 5120000
341747103 apurvsardana1 C Oct. 3, 2025, 6:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 171 11468800
341727082 NenadDapic C Oct. 3, 2025, 5 p.m. OK FPC TESTS 20 499 3276800
341757305 1435730 C Oct. 3, 2025, 8:49 p.m. OK GNU C11 TESTS 20 217 3174400
341736512 Mahir_Uddin C Oct. 3, 2025, 5:30 p.m. OK GNU C11 TESTS 20 1217 4096000
341732523 tejazzz C Oct. 3, 2025, 5:18 p.m. OK GNU C11 TESTS 20 1233 5017600
341784931 ccj123 C Oct. 4, 2025, 5:19 a.m. OK Java 21 TESTS 20 359 921600
341758859 shivansh_123 C Oct. 3, 2025, 9:13 p.m. OK Java 21 TESTS 20 483 2560000
341729613 anshajshukla03 C Oct. 3, 2025, 5:08 p.m. OK Java 21 TESTS 20 483 17510400
341722598 RockingMat C Oct. 3, 2025, 4:47 p.m. OK Java 21 TESTS 20 484 12902400
341734529 m07v C Oct. 3, 2025, 5:24 p.m. OK Java 21 TESTS 20 499 921600
341721690 InfusedParticle C Oct. 3, 2025, 4:44 p.m. OK Java 21 TESTS 20 499 1126400
341746077 fatal-98 C Oct. 3, 2025, 6:50 p.m. OK Java 21 TESTS 20 500 1228800
341725442 BurnerAce07 C Oct. 3, 2025, 4:55 p.m. OK Java 21 TESTS 20 515 921600
341762742 mastacoda C Oct. 3, 2025, 10:40 p.m. OK Java 21 TESTS 20 515 6144000
341730577 disha00 C Oct. 3, 2025, 5:11 p.m. OK Java 21 TESTS 20 562 16281600
341785733 lupunish C Oct. 4, 2025, 5:27 a.m. OK Java 8 TESTS 20 249 7168000
341749912 Eslam_Ahmed C Oct. 3, 2025, 7:24 p.m. OK Java 8 TESTS 20 484 10444800
341753138 chandler1837 C Oct. 3, 2025, 7:59 p.m. OK Java 8 TESTS 20 999 9113600
341721433 tarun_aggarwal_ C Oct. 3, 2025, 4:44 p.m. OK Java 8 TESTS 20 1171 7065600
341784106 kevin_0911 C Oct. 4, 2025, 5:10 a.m. OK Java 8 TESTS 20 1624 0
341785147 archieagarwal C Oct. 4, 2025, 5:22 a.m. OK Java 8 TESTS 20 1640 0
341782385 abhi139 C Oct. 4, 2025, 4:49 a.m. OK Java 8 TESTS 20 1671 0
341783321 abhi139 C Oct. 4, 2025, 5:01 a.m. OK Java 8 TESTS 20 1687 0
341725626 ACE243153 C Oct. 3, 2025, 4:56 p.m. OK Java 8 TESTS 20 1764 0
341757907 sohamgupta.1515 C Oct. 3, 2025, 8:58 p.m. OK PyPy 3 TESTS 20 1999 18841600
341764367 gardengnome C Oct. 3, 2025, 11:36 p.m. OK PyPy 3-64 TESTS 20 249 32768000
341757718 Om_Singh_ C Oct. 3, 2025, 8:55 p.m. OK PyPy 3-64 TESTS 20 281 38809600
341732257 RanjanV_1 C Oct. 3, 2025, 5:17 p.m. OK PyPy 3-64 TESTS 20 296 39731200
341765481 Rahat_Hasan_Akanda C Oct. 4, 2025, 12:14 a.m. OK PyPy 3-64 TESTS 20 296 83353600
341754553 ehdnjs14 C Oct. 3, 2025, 8:15 p.m. OK PyPy 3-64 TESTS 20 311 32870400
341766582 Little_Sheep_Yawn C Oct. 4, 2025, 12:43 a.m. OK PyPy 3-64 TESTS 20 312 32358400
341760348 explainer C Oct. 3, 2025, 9:40 p.m. OK PyPy 3-64 TESTS 20 312 35737600
341732161 nandanipriya C Oct. 3, 2025, 5:16 p.m. OK PyPy 3-64 TESTS 20 327 80486400
341756449 RobinFromTheHood C Oct. 3, 2025, 8:38 p.m. OK PyPy 3-64 TESTS 20 343 31641600
341781402 kke C Oct. 4, 2025, 4:36 a.m. OK PyPy 3-64 TESTS 20 343 42188800
341720387 koushcodes C Oct. 3, 2025, 4:41 p.m. OK Python 3 TESTS 20 514 69632000
341750106 bharatkharbanda4 C Oct. 3, 2025, 7:26 p.m. OK Python 3 TESTS 20 546 62259200
341726610 karleteh C Oct. 3, 2025, 4:59 p.m. OK Python 3 TESTS 20 656 52531200
341731209 alone_drifter C Oct. 3, 2025, 5:13 p.m. OK Python 3 TESTS 20 952 47513600
341723486 MohitS_CF C Oct. 3, 2025, 4:50 p.m. OK Python 3 TESTS 20 1140 75468800
341722280 jai_gurudev C Oct. 3, 2025, 4:46 p.m. OK Python 3 TESTS 20 1280 57036800
341723703 Clouzas C Oct. 3, 2025, 4:50 p.m. OK Python 3 TESTS 20 1828 34099200
341781186 0x81 C Oct. 4, 2025, 4:33 a.m. OK Rust 2024 TESTS 20 156 2867200
341781340 0x81 C Oct. 4, 2025, 4:35 a.m. OK Rust 2024 TESTS 20 202 2867200

remove filters

Back to search problems