Codeforces Round 994 (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
2049 Codeforces Round 994 (Div. 2) FINISHED False 7200 41700323 Dec. 20, 2024, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 1582 ) E Broken Queries PROGRAMMING binary search bitmasks interactive

You, a wizard whose creation was destroyed by a dragon, are determined to hunt it down with a magical AOE tracker. But it seems to be toyed with... This is an interactive problem. There is a hidden binary array (a) of length (n) ((\mathbf{n}) is a power of 2 ) and a hidden integer (k\ (2 \le k \le n - 1)). The array (a) contains exactly one 1 (and all other elements are 0). For two integers (l) and (r) ((1 \le l \le r \le n)), define the range sum (s(l, r) = a_l + a_{l+1} + \cdots + a_r). You have a magical device that takes ranges and returns range sums, but it returns the opposite result when the range has length at least (k). Formally, in one query, you can give it a pair of integers (l, r) where (1 \le l \le r \le n), and it will return either (0) or (1) according to the following rules: If (r - l + 1 < k), it will return (s(l, r)). If (r - l + 1 \ge k), it will return (1 - s(l, r)). Find (k) using at most (33) queries. The device is not adaptive. It means that the hidden (a) and (k) are fixed before the interaction and will not change during the interaction. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 500)). The description of the test cases follows. The first line of each test case contains one positive integer (n) ((4 \le n \le 2^{30})) — the length of the hidden array. It is guaranteed that (\mathbf{n}) is a power of 2 ; that is, (n = 2^m) for some non-negative integer (m). You can make queries in the following way — print one line of the form "(\mathtt{?}\,l\,r)" where (1 \le l \le r \le n). After that, read a single integer: (0) or (1), as described in the statement. If you want to print the answer (k), output "(\mathtt{!}\,k)". Then, the interaction continues with the next test case. Printing the answer does not count towards the number of quer

Tutorials

Codeforces Round #994 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
297545783 zrnstnsr E Dec. 20, 2024, 5:16 p.m. OK C# 10 TESTS 18 296 5734400
297590366 wumaodang E Dec. 21, 2024, 2:40 a.m. OK C++17 (GCC 7-32) TESTS 18 124 0
297551509 n0sk1ll E Dec. 20, 2024, 5:47 p.m. OK C++17 (GCC 7-32) TESTS 18 124 0
297578383 Behind_the_Clouds E Dec. 20, 2024, 9:23 p.m. OK C++17 (GCC 7-32) TESTS 18 139 0
297548938 nudun001 E Dec. 20, 2024, 5:32 p.m. OK C++17 (GCC 7-32) TESTS 18 139 102400
297548399 byebye10000 E Dec. 20, 2024, 5:29 p.m. OK C++17 (GCC 7-32) TESTS 18 139 102400
297545270 stapler E Dec. 20, 2024, 5:14 p.m. OK C++17 (GCC 7-32) TESTS 18 139 819200
297591279 liangzexian E Dec. 21, 2024, 2:57 a.m. OK C++17 (GCC 7-32) TESTS 18 140 0
297590885 daniel604 E Dec. 21, 2024, 2:50 a.m. OK C++17 (GCC 7-32) TESTS 18 140 102400
297590401 D4nnyLee E Dec. 21, 2024, 2:41 a.m. OK C++17 (GCC 7-32) TESTS 18 140 102400
297556877 sjnnjs E Dec. 20, 2024, 6:20 p.m. OK C++17 (GCC 7-32) TESTS 18 140 102400
297545459 Vitaly503 E Dec. 20, 2024, 5:15 p.m. OK C++20 (GCC 13-64) TESTS 18 108 102400
297538154 asdd123 E Dec. 20, 2024, 4:32 p.m. OK C++20 (GCC 13-64) TESTS 18 109 0
297535898 The_Caspian_Sea E Dec. 20, 2024, 4:29 p.m. OK C++20 (GCC 13-64) TESTS 18 109 0
297567953 Azuken E Dec. 20, 2024, 7:37 p.m. OK C++20 (GCC 13-64) TESTS 18 109 102400
297539896 Treks E Dec. 20, 2024, 4:34 p.m. OK C++20 (GCC 13-64) TESTS 18 109 102400
297600373 chaoming E Dec. 21, 2024, 5:09 a.m. OK C++20 (GCC 13-64) TESTS 18 109 1024000
297600650 _WD_ E Dec. 21, 2024, 5:12 a.m. OK C++20 (GCC 13-64) TESTS 18 124 0
297590009 zjdl E Dec. 21, 2024, 2:34 a.m. OK C++20 (GCC 13-64) TESTS 18 124 0
297586361 Bejoker E Dec. 21, 2024, 1:05 a.m. OK C++20 (GCC 13-64) TESTS 18 124 0
297582370 laullelien E Dec. 20, 2024, 10:48 p.m. OK C++20 (GCC 13-64) TESTS 18 124 0
297546726 SSerxhs E Dec. 20, 2024, 5:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 93 102400
297543674 FelixArg E Dec. 20, 2024, 5:07 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 108 0
297563393 ASOUL-Ava E Dec. 20, 2024, 7:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 108 102400
297548394 MagnusCarlsen321 E Dec. 20, 2024, 5:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 109 102400
297586380 MarSer020 E Dec. 21, 2024, 1:05 a.m. OK C++23 (GCC 14-64, msys2) TESTS 18 124 0
297547928 Katu2ou E Dec. 20, 2024, 5:27 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 124 0
297543779 tushaar9876 E Dec. 20, 2024, 5:08 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 124 0
297543758 khoianh E Dec. 20, 2024, 5:08 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 124 0
297605958 lewc E Dec. 21, 2024, 5:56 a.m. OK C++23 (GCC 14-64, msys2) TESTS 18 124 102400
297594145 xuyifei1 E Dec. 21, 2024, 3:46 a.m. OK C++23 (GCC 14-64, msys2) TESTS 18 124 102400
297543261 Gassa E Dec. 20, 2024, 5:06 p.m. OK D TESTS 18 234 102400
297549526 Haksell E Dec. 20, 2024, 5:36 p.m. OK PyPy 3-64 TESTS 18 405 3481600
297581120 Povolotsky E Dec. 20, 2024, 10:11 p.m. OK PyPy 3-64 TESTS 18 468 5120000
297584232 DeadMan69 E Dec. 20, 2024, 11:53 p.m. OK PyPy 3-64 TESTS 18 483 8806400
297551366 ishmeal E Dec. 20, 2024, 5:46 p.m. OK PyPy 3-64 TESTS 18 515 9420800
297543131 _Aditya_Jain_ E Dec. 20, 2024, 5:06 p.m. OK PyPy 3-64 TESTS 18 530 9113600
297556852 bobnuu E Dec. 20, 2024, 6:19 p.m. OK PyPy 3-64 TESTS 18 531 9318400
297537720 CDastrup E Dec. 20, 2024, 4:32 p.m. OK PyPy 3-64 TESTS 18 546 8499200
297534421 fermion5 E Dec. 20, 2024, 4:26 p.m. OK PyPy 3-64 TESTS 18 546 8704000
297537540 harurun4635 E Dec. 20, 2024, 4:31 p.m. OK PyPy 3-64 TESTS 18 562 9318400
297551579 ishmeal E Dec. 20, 2024, 5:48 p.m. OK PyPy 3-64 TESTS 18 640 9523200
297577169 nanoknot E Dec. 20, 2024, 9:05 p.m. OK Rust 2021 TESTS 18 140 102400

remove filters

Back to search problems