Spectral::Cup 2026 Round 1 (Codeforces Round 1094, 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
2222 Spectral::Cup 2026 Round 1 (Codeforces Round 1094, Div. 1 + Div. 2) FINISHED False 9000 1437864 April 25, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 4918 ) C Median Partition PROGRAMMING dp

You are given an array (a) with an odd length (n) consisting of positive integers. You are required to partition the sequence into several subarrays(^{\text{∗}}) with odd lengths and the same median(^{\text{†}}). Your task is to find the maximum number of subarrays. More formally, you are required to find a strictly-increasing sequence (k) with a length of ((p+1)) where (k_1=1) and (k_{p+1}=n+1), such that for every (1\le i\le p), the medians of the sequences (a_{k_i},a_{k_i+1},\ldots,a_{k_{i+1}-1}) are all the same. The parity of (k_i) and (k_{i+1}) should be different. Your task is to find the biggest possible value of (p). (^{\text{∗}})An array (b) is a subarray of an array (a) if (b) can be obtained from (a) by the deletion of several (possibly, zero or all) elements from the beginning and several (possibly, zero or all) elements from the end. (^{\text{†}})The median of an array with an odd length (x) is the (\lceil\frac{x}{2}\rceil)-th element of the array after it is sorted in non-decreasing order. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 1000)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((1\le n \lt 5000), (n) is odd) — the length of (a). The second line contains (n) integers (a_1,a_2,\ldots,a_n) ((1\le a_i\le 10^9)) — the elements of (a). It is guaranteed that the sum of (n^2) over all test cases does not exceed (5000^2). For each test case, output a single integer — the maximum number of subarrays. In the first test case, it is optimal to partition (a) into (\underline 3, \underline 3, \underline{2, 4, 3}). In the second test case, it is optimal to partition (a) into (\underline{9, 5, 7}, \underline 7, \underline{4, 7, 7}). In the third test case, since all the element

Tutorials

Spectral::Cup 2026 Round 1 (Codeforces Round 1094, 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
372545181 volhalink C April 25, 2026, 8:48 p.m. OK C# 13 TESTS 17 187 16588800
372573819 yang00 C April 26, 2026, 6:06 a.m. OK C++17 (GCC 7-32) TESTS 19 46 102400
372569368 ggop123_12 C April 26, 2026, 5:04 a.m. OK C++17 (GCC 7-32) TESTS 17 46 102400
372566476 flowing_dusk C April 26, 2026, 4:08 a.m. OK C++17 (GCC 7-32) TESTS 17 46 102400
372563177 yirandoris C April 26, 2026, 2:55 a.m. OK C++17 (GCC 7-32) TESTS 17 46 102400
372524170 official_harsh C April 25, 2026, 4:54 p.m. OK C++17 (GCC 7-32) TESTS 17 46 102400
372512079 kushagra22072006 C April 25, 2026, 4:09 p.m. OK C++17 (GCC 7-32) TESTS 17 46 102400
372509960 psyduck_1607 C April 25, 2026, 4:02 p.m. OK C++17 (GCC 7-32) TESTS 17 46 102400
372507996 cf_ljy05 C April 25, 2026, 3:55 p.m. OK C++17 (GCC 7-32) TESTS 17 46 102400
372562037 phieu C April 26, 2026, 2:24 a.m. OK C++17 (GCC 7-32) TESTS 17 46 204800
372562496 ice-gruel C April 26, 2026, 2:38 a.m. OK C++17 (GCC 7-32) TESTS 17 62 0
372544621 Optimus_prime6 C April 25, 2026, 8:39 p.m. OK C++20 (GCC 13-64) TESTS 17 31 0
372540622 ArtemDzhava C April 25, 2026, 7:43 p.m. OK C++20 (GCC 13-64) TESTS 17 46 0
372538312 rpam C April 25, 2026, 7:16 p.m. OK C++20 (GCC 13-64) TESTS 17 46 0
372535453 FFFClass_Novice C April 25, 2026, 6:44 p.m. OK C++20 (GCC 13-64) TESTS 17 46 0
372520898 Yui-Yuigahama C April 25, 2026, 4:41 p.m. OK C++20 (GCC 13-64) TESTS 17 46 0
372518860 barani2010 C April 25, 2026, 4:33 p.m. OK C++20 (GCC 13-64) TESTS 17 46 0
372517064 No-oOnE C April 25, 2026, 4:26 p.m. OK C++20 (GCC 13-64) TESTS 17 46 0
372515974 Srend C April 25, 2026, 4:22 p.m. OK C++20 (GCC 13-64) TESTS 17 46 0
372513113 drogbaaaa C April 25, 2026, 4:13 p.m. OK C++20 (GCC 13-64) TESTS 17 46 0
372508750 Easonlcd C April 25, 2026, 3:58 p.m. OK C++20 (GCC 13-64) TESTS 17 46 0
372570547 Eclipse_1077 C April 26, 2026, 5:22 a.m. OK C++23 (GCC 14-64, msys2) TESTS 17 46 0
372567497 ahoooooolic C April 26, 2026, 4:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 17 46 0
372565176 kiniroi C April 26, 2026, 3:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 17 46 0
372554036 HuTao C April 26, 2026, 12:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 17 46 0
372547725 Wageeh C April 25, 2026, 9:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 17 46 0
372532409 reirugan C April 25, 2026, 6:16 p.m. OK C++23 (GCC 14-64, msys2) TESTS 17 46 0
372524050 stillday C April 25, 2026, 4:54 p.m. OK C++23 (GCC 14-64, msys2) TESTS 17 46 0
372521773 Alexa_108 C April 25, 2026, 4:45 p.m. OK C++23 (GCC 14-64, msys2) TESTS 17 46 0
372521600 ngxnlgbao C April 25, 2026, 4:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 17 46 0
372518294 conqueror_of_timosh C April 25, 2026, 4:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 17 46 0
372511566 Gassa C April 25, 2026, 4:07 p.m. OK D TESTS 17 1296 120934400
372522276 ruban C April 25, 2026, 4:47 p.m. OK FPC TESTS 17 250 203980800
372517384 Segmentati0nFault C April 25, 2026, 4:28 p.m. OK GNU C11 TESTS 17 46 204800
372525058 argusvan C April 25, 2026, 4:58 p.m. OK GNU C11 TESTS 17 62 102400
372535649 uchihieu2k7 C April 25, 2026, 6:46 p.m. OK GNU C11 TESTS 17 62 409600
372509624 adityasinghtomar78 C April 25, 2026, 4 p.m. OK Go TESTS 17 78 4198400
372511324 Sunny_Dev C April 25, 2026, 4:06 p.m. OK Java 21 TESTS 17 234 512000
372532514 samurai11 C April 25, 2026, 6:17 p.m. OK Java 21 TESTS 17 250 716800
372510081 Aryan_Yadav123 C April 25, 2026, 4:02 p.m. OK Java 21 TESTS 17 265 102400
372512270 imperial_X C April 25, 2026, 4:10 p.m. OK Java 21 TESTS 17 281 614400
372510799 saifxz C April 25, 2026, 4:04 p.m. OK Java 21 TESTS 17 281 614400
372525419 GuLLu05 C April 25, 2026, 4:59 p.m. OK Java 21 TESTS 17 281 921600
372509789 deshaboinaabhishekyadav C April 25, 2026, 4:01 p.m. OK Java 21 TESTS 17 296 1536000
372519221 vsood C April 25, 2026, 4:35 p.m. OK Java 21 TESTS 17 328 614400
372508426 Rachit_Sharma_14 C April 25, 2026, 3:57 p.m. OK Java 21 TESTS 17 328 614400
372514683 baogiocoduocem C April 25, 2026, 4:18 p.m. OK Java 21 TESTS 17 328 819200
372514882 forsaken724 C April 25, 2026, 4:19 p.m. OK Java 8 TESTS 17 171 39014400
372533882 Pranav_45 C April 25, 2026, 6:29 p.m. OK Java 8 TESTS 17 218 39014400
372508416 yashbansal99 C April 25, 2026, 3:57 p.m. OK Java 8 TESTS 17 296 0
372523694 manubhav731 C April 25, 2026, 4:53 p.m. OK Java 8 TESTS 17 328 0
372508361 hardgonnapass C April 25, 2026, 3:56 p.m. OK Java 8 TESTS 17 843 42086400
372521486 cubeweek C April 25, 2026, 4:44 p.m. OK Kotlin 2.2 TESTS 17 343 25907200
372508517 hirose C April 25, 2026, 3:57 p.m. OK Mono C# TESTS 17 109 6656000
372509929 bitplease_ C April 25, 2026, 4:02 p.m. OK Node.js TESTS 17 703 53043200
372564699 huichen C April 26, 2026, 3:31 a.m. OK PyPy 3 TESTS 17 453 8806400
372518416 rypsa2012 C April 25, 2026, 4:32 p.m. OK PyPy 3-64 TESTS 17 156 4403200
372543056 Sheikah C April 25, 2026, 8:16 p.m. OK PyPy 3-64 TESTS 17 156 4608000
372522940 nd77 C April 25, 2026, 4:50 p.m. OK PyPy 3-64 TESTS 17 187 4608000
372516624 iota_bhai C April 25, 2026, 4:25 p.m. OK PyPy 3-64 TESTS 17 187 7577600
372517706 GalhoumGEE C April 25, 2026, 4:29 p.m. OK PyPy 3-64 TESTS 17 203 5529600
372570313 Godzilla96 C April 26, 2026, 5:19 a.m. OK PyPy 3-64 TESTS 17 203 10649600
372519672 znej C April 25, 2026, 4:36 p.m. OK PyPy 3-64 TESTS 17 218 6144000
372537195 losed3x2 C April 25, 2026, 7:02 p.m. OK PyPy 3-64 TESTS 17 218 11366400
372517528 ising36hz C April 25, 2026, 4:28 p.m. OK PyPy 3-64 TESTS 17 234 5324800
372545146 justmega2510 C April 25, 2026, 8:47 p.m. OK PyPy 3-64 TESTS 17 234 5939200
372507662 Bharath.darla C April 25, 2026, 3:54 p.m. OK Python 2 TESTS 17 1515 102400
372525704 Eigencoder C April 25, 2026, 5 p.m. OK Python 3 TESTS 17 359 8396800
372525434 Soundarya_Dube C April 25, 2026, 4:59 p.m. OK Python 3 TESTS 17 515 8396800
372519830 hk3382 C April 25, 2026, 4:37 p.m. OK Python 3 TESTS 17 765 8396800
372521312 chbhuvan12 C April 25, 2026, 4:43 p.m. OK Python 3 TESTS 17 843 8089600
372526129 DarkWeB10 C April 25, 2026, 5:01 p.m. OK Python 3 TESTS 17 875 8396800
372514589 Nemesis2004 C April 25, 2026, 4:18 p.m. OK Python 3 TESTS 17 1031 1638400
372515189 harsha_jagu C April 25, 2026, 4:20 p.m. OK Python 3 TESTS 17 1296 1536000
372518119 nuriyevisa10 C April 25, 2026, 4:31 p.m. OK Python 3 TESTS 17 1312 8396800
372524690 Shadow.Siren C April 25, 2026, 4:56 p.m. OK Python 3 TESTS 17 1406 1536000
372513864 mahendra3421 C April 25, 2026, 4:15 p.m. OK Python 3 TESTS 17 1468 1536000
372523249 caffeine2ac C April 25, 2026, 4:51 p.m. OK Ruby 3 TESTS 17 1140 4915200
372518734 SaucyFries69 C April 25, 2026, 4:33 p.m. OK Rust 2024 TESTS 17 78 11776000
372512569 neulfox C April 25, 2026, 4:11 p.m. OK Rust 2024 TESTS 17 375 39424000
372523457 Cyros C April 25, 2026, 4:52 p.m. OK Scala TESTS 17 656 307200

remove filters

Back to search problems