Codeforces Round 1087 (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
2209 Codeforces Round 1087 (Div. 2) FINISHED False 7200 2301923 March 21, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 10175 ) C Find the Zero PROGRAMMING constructive algorithms interactive

This is an interactive problem. You are given an integer (n). There is a hidden array (a) of length (2n). Each integer from (1) to (n) appears exactly once in (a). The rest of the elements are all (0). You can make the following type of query: Choose two integers (i) and (j) ((1 \le i,j \le 2n), (i \ne j)). The judge will respond with (1) if (a_i=a_j), and will respond with (0) otherwise. Find any integer (k) ((1 \le k \le 2n)) such that (a_k=0) in no more than (n+1) queries. Note that the interactor is adaptive , which means that the hidden array (a) may change depending on your queries but will not contradict previous queries. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^3)). The description of the test cases follows. The first line of each test case contains an integer (n) ((2 \le n \le 10^4)). The length of the hidden array (a) will be (2n). It is guaranteed that the sum of (n) over all test cases does not exceed (10^4). To make a query, output a line in the following format: (?\;i\;j) ((1 \le i,j \le 2n), (i \ne j)) As a response to the query, you will get: (1) if (a_i=a_j); (0) if (a_i \ne a_j); (-1) if you made an invalid query or if you exceed the limit of (n+1) queries. To report the answer, output a line in the following format: (!\;k) ((1 \le k \le 2n)) After this, proceed to the next test case or terminate if this is the last test case. Note that reporting the answer does not count towards the (n+1) queries. The interactor is adaptive . This means that the hidden array (a) may change depending on your queries but will not contradict previous queries. After printing each query do not forget to output the end of line and flush(^{\text{∗}}) the output. Otherwise, you will get Idleness limit exceeded verdi

Tutorials

Codeforces Round 1087 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
367731317 mdhamid28 C March 22, 2026, 5:26 a.m. OK C++17 (GCC 7-32) TESTS 19 46 0
367730195 skellyjonut C March 22, 2026, 5:10 a.m. OK C++17 (GCC 7-32) TESTS 19 46 0
367682372 sungso376 C March 21, 2026, 4:30 p.m. OK C++17 (GCC 7-32) TESTS 18 46 0
367681967 quagmiree C March 21, 2026, 4:29 p.m. OK C++17 (GCC 7-32) TESTS 18 46 0
367679855 MonoLith C March 21, 2026, 4:25 p.m. OK C++17 (GCC 7-32) TESTS 18 46 0
367678028 zoryn C March 21, 2026, 4:21 p.m. OK C++17 (GCC 7-32) TESTS 18 46 0
367677223 LucZha C March 21, 2026, 4:19 p.m. OK C++17 (GCC 7-32) TESTS 18 46 0
367732395 Saiful_Islam C March 22, 2026, 5:40 a.m. OK C++17 (GCC 7-32) TESTS 19 46 102400
367730463 abhisheksoni0187 C March 22, 2026, 5:14 a.m. OK C++17 (GCC 7-32) TESTS 19 46 102400
367728956 abaabaha C March 22, 2026, 4:51 a.m. OK C++17 (GCC 7-32) TESTS 19 46 102400
367707268 alok_kumar C March 21, 2026, 8:31 p.m. OK C++20 (GCC 13-64) TESTS 19 31 0
367701225 leo_rc C March 21, 2026, 7:10 p.m. OK C++20 (GCC 13-64) TESTS 18 31 102400
367732860 Anish_Saxena C March 22, 2026, 5:45 a.m. OK C++20 (GCC 13-64) TESTS 19 46 0
367730726 yaaatri C March 22, 2026, 5:18 a.m. OK C++20 (GCC 13-64) TESTS 19 46 0
367730409 Orion_11 C March 22, 2026, 5:13 a.m. OK C++20 (GCC 13-64) TESTS 19 46 0
367729421 Ansh2008 C March 22, 2026, 4:59 a.m. OK C++20 (GCC 13-64) TESTS 19 46 0
367729124 Maheshk_45 C March 22, 2026, 4:54 a.m. OK C++20 (GCC 13-64) TESTS 19 46 0
367728144 Labib_Rafid C March 22, 2026, 4:38 a.m. OK C++20 (GCC 13-64) TESTS 19 46 0
367727992 Ahmed_Ashraf_Moriarty C March 22, 2026, 4:35 a.m. OK C++20 (GCC 13-64) TESTS 19 46 0
367726194 pritam-bsk C March 22, 2026, 4:02 a.m. OK C++20 (GCC 13-64) TESTS 19 46 0
367726453 fatelessvenerable22 C March 22, 2026, 4:07 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 31 0
367683191 Mandy_1 C March 21, 2026, 4:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 18 31 0
367712374 RReyes2612 C March 21, 2026, 10:18 p.m. OK C++23 (GCC 14-64, msys2) TESTS 19 31 102400
367731420 hetpethani17 C March 22, 2026, 5:28 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 46 0
367730475 Dakait_State C March 22, 2026, 5:14 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 46 0
367728873 ClashLegend C March 22, 2026, 4:50 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 46 0
367728715 oldyao C March 22, 2026, 4:47 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 46 0
367724058 Kognition C March 22, 2026, 3:21 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 46 0
367722188 Yvone_Lin C March 22, 2026, 2:41 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 46 0
367721991 get_WA C March 22, 2026, 2:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 19 46 0
367679688 pengin_2000 C March 21, 2026, 4:24 p.m. OK GNU C11 TESTS 18 78 8396800
367679629 frag_ C March 21, 2026, 4:24 p.m. OK GNU C11 TESTS 18 125 8396800
367717755 0x3F C March 22, 2026, 12:41 a.m. OK Go TESTS 19 78 716800
367703862 abezr882 C March 21, 2026, 7:41 p.m. OK Go TESTS 19 125 204800
367717670 0x3F C March 22, 2026, 12:39 a.m. OK Go TESTS 19 125 716800
367684301 glebsamsonov C March 21, 2026, 4:33 p.m. OK Go TESTS 18 203 204800
367706549 ASHH_27 C March 21, 2026, 8:19 p.m. OK Java 21 TESTS 19 281 2252800
367685283 Uchiha1015 C March 21, 2026, 4:34 p.m. OK Java 21 TESTS 18 312 512000
367682420 SCOOBY C March 21, 2026, 4:30 p.m. OK Java 21 TESTS 18 328 819200
367705647 JasHS C March 21, 2026, 8:04 p.m. OK Java 21 TESTS 19 328 1331200
367704100 SIDH_777 C March 21, 2026, 7:43 p.m. OK Java 21 TESTS 19 343 1126400
367681563 Sudip613 C March 21, 2026, 4:28 p.m. OK Java 21 TESTS 18 343 1228800
367720134 Wheelchair C March 22, 2026, 1:50 a.m. OK Java 21 TESTS 19 343 1638400
367683479 vigneshgopal200 C March 21, 2026, 4:32 p.m. OK Java 21 TESTS 18 359 716800
367707304 saanikaa C March 21, 2026, 8:32 p.m. OK Java 21 TESTS 19 359 921600
367682338 pathashiva12 C March 21, 2026, 4:30 p.m. OK Java 21 TESTS 18 359 1024000
367678818 nikhil_chahar121 C March 21, 2026, 4:23 p.m. OK Java 8 TESTS 18 281 0
367680470 Nitzyy C March 21, 2026, 4:26 p.m. OK Java 8 TESTS 18 296 0
367678896 sybang97 C March 21, 2026, 4:23 p.m. OK Java 8 TESTS 18 296 0
367702342 Techoo5 C March 21, 2026, 7:23 p.m. OK Java 8 TESTS 19 312 0
367678834 sneha31415 C March 21, 2026, 4:23 p.m. OK Java 8 TESTS 18 359 0
367679604 yg.margo C March 21, 2026, 4:24 p.m. OK Kotlin 2.2 TESTS 18 265 23961600
367680804 pyl_youngboy C March 21, 2026, 4:27 p.m. OK PyPy 3 TESTS 18 343 4608000
367681710 rafsimons C March 21, 2026, 4:28 p.m. OK PyPy 3 TESTS 18 406 6860800
367682417 deepsr2003 C March 21, 2026, 4:30 p.m. OK PyPy 3 TESTS 18 437 7987200
367705957 rabeysin C March 21, 2026, 8:10 p.m. OK PyPy 3 TESTS 19 515 10137600
367693817 Anirban2046 C March 21, 2026, 5:58 p.m. OK PyPy 3-64 TESTS 18 156 2764800
367716836 nhtlongcs C March 22, 2026, 12:13 a.m. OK PyPy 3-64 TESTS 19 187 4198400
367715872 mawo78 C March 21, 2026, 11:59 p.m. OK PyPy 3-64 TESTS 19 203 3481600
367713824 michael3437 C March 21, 2026, 11:09 p.m. OK PyPy 3-64 TESTS 19 203 3584000
367707528 gardengnome C March 21, 2026, 8:36 p.m. OK PyPy 3-64 TESTS 19 203 3686400
367704105 Sodasman C March 21, 2026, 7:43 p.m. OK PyPy 3-64 TESTS 19 203 4096000
367685415 CognitiveAtrophy C March 21, 2026, 4:34 p.m. OK PyPy 3-64 TESTS 18 203 4198400
367682478 Zervic07 C March 21, 2026, 4:30 p.m. OK PyPy 3-64 TESTS 18 218 2764800
367720304 Ravinder-codes C March 22, 2026, 1:55 a.m. OK PyPy 3-64 TESTS 19 218 4812800
367684065 ringwayy C March 21, 2026, 4:33 p.m. OK PyPy 3-64 TESTS 18 218 5632000
367700440 deveshmirchandani C March 21, 2026, 7:01 p.m. OK Python 3 TESTS 18 156 204800
367682668 K1taIkuyo C March 21, 2026, 4:30 p.m. OK Python 3 TESTS 18 171 204800
367682005 1ncinerate C March 21, 2026, 4:29 p.m. OK Python 3 TESTS 18 171 204800
367706308 davidmiheev C March 21, 2026, 8:15 p.m. OK Python 3 TESTS 19 171 614400
367682133 korenihar5 C March 21, 2026, 4:29 p.m. OK Python 3 TESTS 18 171 1331200
367726631 codelearner41 C March 22, 2026, 4:11 a.m. OK Python 3 TESTS 19 187 204800
367733651 saispandana.chalasani05 C March 22, 2026, 5:55 a.m. OK Python 3 TESTS 19 203 204800
367720904 googlecracker99 C March 22, 2026, 2:11 a.m. OK Python 3 TESTS 19 203 204800
367695990 cescatti C March 21, 2026, 6:17 p.m. OK Python 3 TESTS 18 203 204800
367685024 GagikMelkumyan C March 21, 2026, 4:34 p.m. OK Python 3 TESTS 18 203 204800
367679937 AviShahCode C March 21, 2026, 4:25 p.m. OK Rust 2024 TESTS 18 46 0

remove filters

Back to search problems