Codeforces Round 1054 (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
2149 Codeforces Round 1054 (Div. 3) FINISHED False 8100 17594723 Sept. 25, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 9185 ) E Hidden Knowledge of the Ancients PROGRAMMING data structures two pointers

In the world of Deepwoken , there exists an ancient artifact — Tablet of Infinite Knowledge , on which a sequence of (n) mysterious symbols (each symbol is an integer) is engraved. It is said that the true power of the artifact can only be revealed by finding all sacred fragments — continuous segments of the tablet that contain exactly (k) distinct numbers, and their length must be between (l) and (r) (inclusive). Formally: Given a sequence (a) of length (n) and integers (k), (l), (r). You need to find the number of such boundaries (b) and (c) such that: (1 \le b \le c \le n); among the elements (a_{b}, a_{b + 1}, \dots, a_{c}) there are exactly (k) distinct numbers; (l \leq c - b + 1 \leq r). Each test consists of several test cases. The first line contains one integer (t) ((1 \le t \le 10^4)) — the number of test cases. The following describes the test cases. The first line of each test case contains four integers: (n), (k), (l), and (r) (( 1 \le k \le n \le 2 \cdot 10^5, 1 \le l \le r \le n)). The second line contains (n) numbers (a_i) ((1 \le a_i \le 10^9)) — the mysterious symbols. It is guaranteed that the total value of (n) over all test cases does not exceed (2 \cdot 10^5). For each test, output a single integer on a separate line — the number of continuous subarrays that meet the specified conditions. In the first test case (a=5), there is only one subarray (5), which has a length of 1 and contains exactly (1) distinct number. In the fourth test case (a=7,7,7,7), any subarray of identical numbers gives exactly (1) distinct number. The start and end of possible subarrays are: Length (1): (1,1), (2,2), (3,3), (4,4). Length (2): (1,2), (2,3), (3,4). In the fifth test case (a=1,2,1,2,3,2,1): Length (2): all subarrays have only (2) distinct numbers. Length

Tutorials

__rose

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
340541843 PatrickCcoaPerez E Sept. 25, 2025, 11:32 p.m. OK C# 13 TESTS 24 218 78336000
340563838 soju_ E Sept. 26, 2025, 5:15 a.m. OK C++17 (GCC 7-32) TESTS 24 109 0
340525922 prince9369 E Sept. 25, 2025, 7:22 p.m. OK C++17 (GCC 7-32) TESTS 24 109 0
340522860 andersonfalcao E Sept. 25, 2025, 6:51 p.m. OK C++17 (GCC 7-32) TESTS 24 109 0
340564538 soju_ E Sept. 26, 2025, 5:23 a.m. OK C++17 (GCC 7-32) TESTS 24 124 0
340564211 prashantdlp E Sept. 26, 2025, 5:20 a.m. OK C++17 (GCC 7-32) TESTS 24 124 0
340541041 stoney E Sept. 25, 2025, 11:10 p.m. OK C++17 (GCC 7-32) TESTS 24 124 0
340522943 ha203811 E Sept. 25, 2025, 6:52 p.m. OK C++17 (GCC 7-32) TESTS 24 124 0
340518671 chslnikl E Sept. 25, 2025, 6:13 p.m. OK C++17 (GCC 7-32) TESTS 16 124 102400
340506285 olivvan E Sept. 25, 2025, 4:49 p.m. OK C++17 (GCC 7-32) TESTS 16 124 102400
340549182 OIer_wst E Sept. 26, 2025, 2:05 a.m. OK C++17 (GCC 7-32) TESTS 24 124 2457600
340545633 kendas E Sept. 26, 2025, 1 a.m. OK C++20 (GCC 13-64) TESTS 24 93 0
340531941 317 E Sept. 25, 2025, 8:34 p.m. OK C++20 (GCC 13-64) TESTS 24 93 921600
340542704 thecodingraceteam E Sept. 25, 2025, 11:54 p.m. OK C++20 (GCC 13-64) TESTS 24 108 921600
340504777 egor_mikhalkov E Sept. 25, 2025, 4:47 p.m. OK C++20 (GCC 13-64) TESTS 16 109 921600
340562725 fuyo1622 E Sept. 26, 2025, 5:03 a.m. OK C++20 (GCC 13-64) TESTS 24 109 1740800
340545117 Fushengh E Sept. 26, 2025, 12:50 a.m. OK C++20 (GCC 13-64) TESTS 24 109 2560000
340544786 Hieungan E Sept. 26, 2025, 12:43 a.m. OK C++20 (GCC 13-64) TESTS 24 109 8089600
340555567 RaislinSnow E Sept. 26, 2025, 3:40 a.m. OK C++20 (GCC 13-64) TESTS 24 109 8396800
340552498 6434554613 E Sept. 26, 2025, 2:56 a.m. OK C++20 (GCC 13-64) TESTS 24 124 0
340512895 diobrando97 E Sept. 25, 2025, 5:25 p.m. OK C++20 (GCC 13-64) TESTS 16 124 0
340558468 L2ngg E Sept. 26, 2025, 4:24 a.m. OK C++23 (GCC 14-64, msys2) TESTS 24 93 0
340553874 welken E Sept. 26, 2025, 3:16 a.m. OK C++23 (GCC 14-64, msys2) TESTS 24 93 0
340547575 _Kur1su_ E Sept. 26, 2025, 1:37 a.m. OK C++23 (GCC 14-64, msys2) TESTS 24 93 0
340503422 adnan32221 E Sept. 25, 2025, 4:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 16 93 0
340558291 limx E Sept. 26, 2025, 4:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 24 108 0
340555746 Bikodoo2010 E Sept. 26, 2025, 3:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 24 108 0
340554778 liuyan1217 E Sept. 26, 2025, 3:28 a.m. OK C++23 (GCC 14-64, msys2) TESTS 24 108 0
340551223 UFEQ E Sept. 26, 2025, 2:37 a.m. OK C++23 (GCC 14-64, msys2) TESTS 24 108 0
340540239 neto04 E Sept. 25, 2025, 10:49 p.m. OK C++23 (GCC 14-64, msys2) TESTS 24 108 0
340551457 Hanyilin E Sept. 26, 2025, 2:41 a.m. OK C++23 (GCC 14-64, msys2) TESTS 24 108 204800
340506451 placeholder112358 E Sept. 25, 2025, 4:49 p.m. OK Java 21 TESTS 16 311 204800
340506098 punitpunde E Sept. 25, 2025, 4:48 p.m. OK Java 21 TESTS 16 343 4915200
340506815 IvyReverie E Sept. 25, 2025, 4:49 p.m. OK Java 21 TESTS 16 374 1843200
340505441 RockStar132 E Sept. 25, 2025, 4:48 p.m. OK Java 21 TESTS 16 390 5017600
340525512 cstemp E Sept. 25, 2025, 7:18 p.m. OK Java 21 TESTS 24 437 13721600
340561031 rahulkrchaudhary E Sept. 26, 2025, 4:50 a.m. OK Java 21 TESTS 24 467 4505600
340521863 BiggestFish06 E Sept. 25, 2025, 6:41 p.m. OK Java 21 TESTS 24 483 7270400
340509160 InfinityX E Sept. 25, 2025, 5:01 p.m. OK Java 21 TESTS 16 484 3481600
340566835 jindal2004keshav E Sept. 26, 2025, 5:48 a.m. OK Java 21 TESTS 24 499 20582400
340515254 WrongAnswerOnTestCase2 E Sept. 25, 2025, 5:44 p.m. OK Java 21 TESTS 16 639 28364800
340505211 iamkhushi5621 E Sept. 25, 2025, 4:47 p.m. OK Java 8 TESTS 16 312 0
340505980 vedbhutada77 E Sept. 25, 2025, 4:48 p.m. OK Java 8 TESTS 16 515 0
340503872 P_ragya E Sept. 25, 2025, 4:45 p.m. OK Java 8 TESTS 16 531 0
340514007 shark17 E Sept. 25, 2025, 5:34 p.m. OK Java 8 TESTS 16 546 0
340544692 priyankahotkar_ E Sept. 26, 2025, 12:41 a.m. OK Java 8 TESTS 24 593 0
340512542 challavishweshwar E Sept. 25, 2025, 5:23 p.m. OK PyPy 3 TESTS 16 609 21401600
340511421 modelflat E Sept. 25, 2025, 5:15 p.m. OK PyPy 3-64 TESTS 16 233 39116800
340527622 Meek_12 E Sept. 25, 2025, 7:41 p.m. OK PyPy 3-64 TESTS 24 249 30617600
340520499 LMeyling E Sept. 25, 2025, 6:29 p.m. OK PyPy 3-64 TESTS 24 249 33792000
340526050 denilb E Sept. 25, 2025, 7:23 p.m. OK PyPy 3-64 TESTS 24 280 32665600
340508417 helltractor E Sept. 25, 2025, 4:57 p.m. OK PyPy 3-64 TESTS 16 296 37580800
340539816 monocrap E Sept. 25, 2025, 10:36 p.m. OK PyPy 3-64 TESTS 24 311 43417600
340565488 maruf_khan96 E Sept. 26, 2025, 5:34 a.m. OK PyPy 3-64 TESTS 24 311 57036800
340510423 V3k0r E Sept. 25, 2025, 5:09 p.m. OK PyPy 3-64 TESTS 16 343 47001600
340531777 Ayushman_123 E Sept. 25, 2025, 8:32 p.m. OK PyPy 3-64 TESTS 24 358 31334400
340508688 Fishion E Sept. 25, 2025, 4:59 p.m. OK PyPy 3-64 TESTS 16 359 35430400

remove filters

Back to search problems