Codeforces Round 1022 (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
2108 Codeforces Round 1022 (Div. 2) FINISHED False 7200 30295523 May 1, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 2414 ) D Needle in a Numstack PROGRAMMING binary search brute force interactive math

This is an interactive problem. You found the numbers (k) and (n) in the attic, but lost two arrays (A) and (B). You remember that: (|A| + |B| = n), the total length of the arrays is (n). (|A| \geq k) and (|B| \geq k), the length of each array is at least (k). The arrays consist only of numbers from (1) to (k). If you take any (k) consecutive elements from array (A), they will all be different. Also, if you take any (k) consecutive elements from array (B), they will all be different. Fortunately, a kind spirit that settled in the attic found these arrays and concatenated them into an array (C) of length (n). That is, the elements of array (A) were first written into array (C), followed by the elements of array (B). You can ask the kind spirit up to (250) questions. Each question contains an index (i) ((1 \leq i \leq n)). In response, you will receive the (i)-th element of the concatenated array (C). You need to find the lengths of arrays (A) and (B), or report that it is impossible to determine them uniquely. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 300)). The description of the test cases follows. The only line of each test case contains two integers (n) and (k) ((1 \leq k \leq 50), (2 k \leq n \leq 10^{6})). Note that the sum of (n) across test cases is not limited . The interaction for each test case begins with reading the integer (n). Then you can make up to (250) queries. To make a query, output a string in the format " ? x " (without quotes) ((1 \leq x \leq n)). After each query, read an integer — the answer to your query. If you make too many queries, you will receive a verdict of Wrong answer . To report your answer, output a string in the format " ! a b " (without quotes), where (a) and (b) are the lengths of arrays (A) and

Tutorials

Codeforces Round 1022 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
318014494 x1f0cb32d3_ D May 1, 2025, 4:33 p.m. OK C# 10 TESTS 23 312 3891200
318010832 og.kostya D May 1, 2025, 4:26 p.m. OK C# 10 TESTS 23 312 5120000
318020605 -firefly- D May 1, 2025, 5:18 p.m. OK C# 10 TESTS 23 359 9830400
318067830 little_happy D May 2, 2025, 5:55 a.m. OK C++17 (GCC 7-32) TESTS 23 140 0
318039090 Murinho D May 1, 2025, 8:21 p.m. OK C++17 (GCC 7-32) TESTS 23 203 24064000
318020617 firework_0 D May 1, 2025, 5:18 p.m. OK C++17 (GCC 7-32) TESTS 23 218 0
318051679 6fishes D May 2, 2025, 1:26 a.m. OK C++17 (GCC 7-32) TESTS 23 218 102400
318047328 gokulakannansivaji D May 1, 2025, 11:10 p.m. OK C++17 (GCC 7-32) TESTS 23 218 102400
318036305 cp_first D May 1, 2025, 7:42 p.m. OK C++17 (GCC 7-32) TESTS 23 218 102400
318010677 vventi D May 1, 2025, 4:26 p.m. OK C++17 (GCC 7-32) TESTS 23 218 102400
318065302 Peddy D May 2, 2025, 5:26 a.m. OK C++17 (GCC 7-32) TESTS 23 233 0
318024704 ElyesChaabouni D May 1, 2025, 5:45 p.m. OK C++17 (GCC 7-32) TESTS 23 233 102400
318047889 Donwei D May 1, 2025, 11:28 p.m. OK C++17 (GCC 7-32) TESTS 23 234 0
318027701 Short_Bit D May 1, 2025, 6:09 p.m. OK C++20 (GCC 13-64) TESTS 23 140 0
318010966 99_wood D May 1, 2025, 4:26 p.m. OK C++20 (GCC 13-64) TESTS 23 156 0
318026828 lvsc__ D May 1, 2025, 6:02 p.m. OK C++20 (GCC 13-64) TESTS 23 171 102400
318009541 MarioYC D May 1, 2025, 4:23 p.m. OK C++20 (GCC 13-64) TESTS 23 171 102400
318055949 doshite D May 2, 2025, 2:56 a.m. OK C++20 (GCC 13-64) TESTS 23 186 102400
318038602 hundunlilun1 D May 1, 2025, 8:14 p.m. OK C++20 (GCC 13-64) TESTS 23 187 0
318025379 adnadniwe D May 1, 2025, 5:51 p.m. OK C++20 (GCC 13-64) TESTS 23 187 102400
318019018 zeemanz D May 1, 2025, 5:09 p.m. OK C++20 (GCC 13-64) TESTS 23 187 102400
318011083 d3press3d D May 1, 2025, 4:27 p.m. OK C++20 (GCC 13-64) TESTS 23 187 102400
318043001 smf D May 1, 2025, 9:27 p.m. OK C++20 (GCC 13-64) TESTS 23 202 0
318035624 Wawi_ D May 1, 2025, 7:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 23 140 102400
318068075 Null_Resot D May 2, 2025, 5:58 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 171 102400
318030887 Cyber D May 1, 2025, 6:40 p.m. OK C++23 (GCC 14-64, msys2) TESTS 23 171 102400
318013467 Wawi_ D May 1, 2025, 4:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 23 171 102400
318058896 7_divided_by_3 D May 2, 2025, 3:46 a.m. OK C++23 (GCC 14-64, msys2) TESTS 23 186 0
318020411 CoderAbhi27 D May 1, 2025, 5:17 p.m. OK C++23 (GCC 14-64, msys2) TESTS 23 186 102400
318026173 Auchenai01 D May 1, 2025, 5:57 p.m. OK C++23 (GCC 14-64, msys2) TESTS 23 187 0
318035567 FUFEELINGS D May 1, 2025, 7:32 p.m. OK C++23 (GCC 14-64, msys2) TESTS 23 187 102400
318021081 guperman D May 1, 2025, 5:21 p.m. OK C++23 (GCC 14-64, msys2) TESTS 23 187 102400
318018091 Yuanyin26 D May 1, 2025, 5:03 p.m. OK C++23 (GCC 14-64, msys2) TESTS 23 187 102400
318018633 rainboy D May 1, 2025, 5:07 p.m. OK GNU C11 TESTS 23 452 8396800
318015679 sahasrad D May 1, 2025, 4:34 p.m. OK Java 21 TESTS 23 1155 1331200
318007236 Only_Sanity D May 1, 2025, 4:18 p.m. OK Java 21 TESTS 23 1999 2048000
318036618 sushmanth.dampur8780 D May 1, 2025, 7:46 p.m. OK PyPy 3-64 TESTS 23 624 5529600
318036159 sushmanth.dampur8780 D May 1, 2025, 7:40 p.m. OK PyPy 3-64 TESTS 23 687 6041600
318019592 nwblanton D May 1, 2025, 5:12 p.m. OK PyPy 3-64 TESTS 23 702 8089600
318007199 ssstormmid D May 1, 2025, 4:18 p.m. OK PyPy 3-64 TESTS 23 718 6451200
318029077 jefferson.simoes D May 1, 2025, 6:21 p.m. OK PyPy 3-64 TESTS 23 750 9011200
318066033 hxu10 D May 2, 2025, 5:35 a.m. OK PyPy 3-64 TESTS 23 765 9113600
318063399 Ezru1 D May 2, 2025, 5:01 a.m. OK PyPy 3-64 TESTS 23 796 9113600
318036318 sushmanth.dampur8780 D May 1, 2025, 7:42 p.m. OK PyPy 3-64 TESTS 23 811 6041600
318008407 TJacobus D May 1, 2025, 4:20 p.m. OK PyPy 3-64 TESTS 23 828 8499200
318011331 ThatOnePythonUser D May 1, 2025, 4:27 p.m. OK PyPy 3-64 TESTS 23 858 6041600
318022069 squarefk D May 1, 2025, 5:27 p.m. OK Python 3 TESTS 23 984 512000
318021729 CoCo_Japan_pan D May 1, 2025, 5:25 p.m. OK Rust 2021 TESTS 23 296 102400
318008199 IkeBarlow D May 1, 2025, 4:20 p.m. OK Rust 2021 TESTS 23 327 102400
318011887 DanielAnker D May 1, 2025, 4:28 p.m. OK Rust 2021 TESTS 23 375 0
318008560 darkkcyan D May 1, 2025, 4:21 p.m. OK Rust 2021 TESTS 23 405 102400

remove filters

Back to search problems