Codeforces Round 1063 (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
2163 Codeforces Round 1063 (Div. 2) FINISHED False 7200 13618523 Nov. 10, 2025, 3:05 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1484 ) D2 Diadrash (Hard Version) PROGRAMMING binary search interactive

This is the Hard version of the problem. The difference between the versions is that in this version, you can make at most (30) queries. You can hack only if you solved all versions of this problem. This problem is interactive. There is a permutation(^{\text{∗}}) (p) of the integers from (0) to (n-1) hidden from you. Additionally, you are given (q) ranges (l_1, r_1, l_2, r_2, \ldots, l_q, r_q) where (1 \le l_i \le r_i \le n). You need to discover the maximum (\operatorname{MEX}) among the values of (p) in the (q) ranges that are given to you in the input. Formally, you must discover the value of (\max _{i=1}^q {\operatorname{MEX}(p_{l_i}, p_{l_i+1}, \ldots, p_{r_i})})(^{\text{†}}). To do this, you may make at most (30) queries of the following form: Choose any two integers (1 \le l \le r \le n) and you will receive the value (\operatorname{MEX}(p_{l}, p_{l+1}, \ldots, p_{r})). (^{\text{∗}})A permutation of the integers from (0) to (n-1) is a sequence of (n) elements where every integer from (0) to (n-1) appears exactly once. For example, the sequence (0, 3, 1, 2) is a permutation, but the sequence (0, 0, 2, 1) is not. (^{\text{†}})The (\operatorname{MEX}) of a sequence is defined as the smallest non-negative integer that does not appear in that sequence. For example, (\operatorname{MEX}(0, 0, 1, 3) = 2) and (\operatorname{MEX}(1, 2, 2) = 0.) Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 100)). The description of the test cases follows. The first line of each test case contains exactly two integers (n) and (q) ((4 \le n \le 10^4), (1 \le q \le 3 \cdot 10^5)) — the size of the permutation and the number of ranges, respectively. The (i)-th of the next (q) lines contains two integers (l_i, r_i) ((1 \le l_i \le r_i \le n)). It is guar

Tutorials

Codeforces Round 1063 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
348367566 JakobZ D2 Nov. 10, 2025, 5:03 p.m. OK C++17 (GCC 7-32) TESTS 25 249 0
348360463 jununu0811 D2 Nov. 10, 2025, 4:50 p.m. OK C++17 (GCC 7-32) TESTS 25 281 7577600
348394928 Molingen D2 Nov. 10, 2025, 9:16 p.m. OK C++17 (GCC 7-32) TESTS 27 343 0
348385836 catforces D2 Nov. 10, 2025, 7:37 p.m. OK C++17 (GCC 7-32) TESTS 27 343 0
348376260 codecrushr D2 Nov. 10, 2025, 6:11 p.m. OK C++17 (GCC 7-32) TESTS 26 343 0
348364763 Az3ar D2 Nov. 10, 2025, 4:58 p.m. OK C++17 (GCC 7-32) TESTS 25 343 2355200
348372555 vedantjain29 D2 Nov. 10, 2025, 5:47 p.m. OK C++17 (GCC 7-32) TESTS 26 358 0
348425327 h7373 D2 Nov. 11, 2025, 5:47 a.m. OK C++17 (GCC 7-32) TESTS 27 359 2457600
348403906 just_common D2 Nov. 11, 2025, 12:56 a.m. OK C++17 (GCC 7-32) TESTS 27 374 0
348400931 andriaberi D2 Nov. 10, 2025, 11:19 p.m. OK C++17 (GCC 7-32) TESTS 27 374 0
348416185 ywc_ D2 Nov. 11, 2025, 4:08 a.m. OK C++20 (GCC 13-64) TESTS 27 218 0
348407999 flysnow D2 Nov. 11, 2025, 2:28 a.m. OK C++20 (GCC 13-64) TESTS 27 218 102400
348359566 Astatinear D2 Nov. 10, 2025, 4:48 p.m. OK C++20 (GCC 13-64) TESTS 25 233 2457600
348366373 AryRDW D2 Nov. 10, 2025, 5:01 p.m. OK C++20 (GCC 13-64) TESTS 25 249 1433600
348362848 ammar2000 D2 Nov. 10, 2025, 4:55 p.m. OK C++20 (GCC 13-64) TESTS 25 249 3481600
348372419 PetaLinGer. D2 Nov. 10, 2025, 5:46 p.m. OK C++20 (GCC 13-64) TESTS 25 264 0
348415298 Remgagagali727 D2 Nov. 11, 2025, 3:57 a.m. OK C++20 (GCC 13-64) TESTS 27 265 3584000
348366802 latanchar D2 Nov. 10, 2025, 5:02 p.m. OK C++20 (GCC 13-64) TESTS 25 280 24064000
348408519 guoyitao D2 Nov. 11, 2025, 2:39 a.m. OK C++20 (GCC 13-64) TESTS 27 281 9625600
348365307 TheSahib D2 Nov. 10, 2025, 4:59 p.m. OK C++20 (GCC 13-64) TESTS 25 281 9728000
348377041 vedantkohad D2 Nov. 10, 2025, 6:17 p.m. OK C++23 (GCC 14-64, msys2) TESTS 26 203 0
348424863 omkar_169 D2 Nov. 11, 2025, 5:42 a.m. OK C++23 (GCC 14-64, msys2) TESTS 27 218 1024000
348420179 AniruddhSaraf D2 Nov. 11, 2025, 5:09 a.m. OK C++23 (GCC 14-64, msys2) TESTS 27 233 102400
348365418 Charming D2 Nov. 10, 2025, 5 p.m. OK C++23 (GCC 14-64, msys2) TESTS 25 234 102400
348365525 Ibrahimfostok D2 Nov. 10, 2025, 5 p.m. OK C++23 (GCC 14-64, msys2) TESTS 25 250 1536000
348427000 1egend D2 Nov. 11, 2025, 6:04 a.m. OK C++23 (GCC 14-64, msys2) TESTS 27 265 0
348361577 MrPython D2 Nov. 10, 2025, 4:52 p.m. OK C++23 (GCC 14-64, msys2) TESTS 25 265 0
348364533 Retired_Isaunoya D2 Nov. 10, 2025, 4:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 25 265 102400
348359854 ConNuoiAnhThai D2 Nov. 10, 2025, 4:48 p.m. OK C++23 (GCC 14-64, msys2) TESTS 25 265 102400
348427214 iridescent_1024 D2 Nov. 11, 2025, 6:06 a.m. OK C++23 (GCC 14-64, msys2) TESTS 27 280 1536000
348376873 AnimeshT1008 D2 Nov. 10, 2025, 6:16 p.m. OK Java 21 TESTS 26 781 1843200
348396882 Om_Singh_ D2 Nov. 10, 2025, 9:50 p.m. OK PyPy 3-64 TESTS 27 531 3788800
348371358 34z12000 D2 Nov. 10, 2025, 5:41 p.m. OK PyPy 3-64 TESTS 25 546 3788800
348397422 VaHiX D2 Nov. 10, 2025, 9:59 p.m. OK PyPy 3-64 TESTS 27 562 37478400
348377255 shadow4720 D2 Nov. 10, 2025, 6:19 p.m. OK PyPy 3-64 TESTS 26 593 45260800
348407172 V3k0r D2 Nov. 11, 2025, 2:12 a.m. OK PyPy 3-64 TESTS 27 608 8192000
348401980 IcyGirl D2 Nov. 10, 2025, 11:55 p.m. OK PyPy 3-64 TESTS 27 718 39424000
348371446 kryoton_98 D2 Nov. 10, 2025, 5:41 p.m. OK PyPy 3-64 TESTS 25 859 7372800
348395922 gardengnome D2 Nov. 10, 2025, 9:34 p.m. OK PyPy 3-64 TESTS 27 1562 50073600
348380611 Ab_hoga_real_Cumback D2 Nov. 10, 2025, 6:46 p.m. OK Python 3 TESTS 26 655 1843200

remove filters

Back to search problems