Codeforces Round 1056 (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
2155 Codeforces Round 1056 (Div. 2) FINISHED False 7200 16723523 Oct. 5, 2025, 4:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 5821 ) D Batteries PROGRAMMING interactive math

This is an interactive problem. Refer to the Interaction section below for better understanding. There are (n) ((2 \le n \le 40)) batteries numbered (1, 2, \ldots, n). Some of them work while the others don't. Let (a) be the number of batteries that work. It is guaranteed that (\mathbf{a \geq 2}). You are given (n) but not (a). There is a flashlight which can hold two batteries and it only turns on when both batteries work. The batteries have been shuffled and you don't know which ones work and which ones don't. You can choose two batteries and try them in the flashlight. You want to find a pair of batteries that work. However, you are worried about breaking the flashlight, so you want to limit the amount of trials you attempt. Therefore, you should find a pair of working batteries using at most (\left \lfloor \frac{n^2}{a} \right \rfloor) trials. The interactor is adaptive . This means that whether battery (i) ((1 \le i \le n)) works is not fixed and may change during the interaction. However, it is guaranteed that there exists a configuration of (a) working batteries that is consistent with the information that you have received so far. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 50)). The description of the test cases follows. The first line of each test case contains a single integer (n) ((2 \le n \le 40)) — the number of batteries. It is guaranteed that the sum of (n) over all test cases does not exceed (200). The interaction for each test case begins with reading the integer (n). To make a query, print a single line with two integers in the following format: (\mathbb{u}\,\mathbb{v}) ((1 \leq u, v \leq n) and (u \neq v)) — the indices of the batteries you want to test. After that, read a single integer (x) — indicating whether the flashlight turned on after inserting those (2) batteries. If $$$x=1$$

Tutorials

Codeforces Round 1056 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
342104855 AnatolyTolstobrov D Oct. 5, 2025, 6:12 p.m. OK C# 10 TESTS 29 171 102400
342138462 yashjonjale D Oct. 6, 2025, 12:13 a.m. OK C++17 (GCC 7-32) TESTS 29 46 0
342128890 manikm1 D Oct. 5, 2025, 8:46 p.m. OK C++17 (GCC 7-32) TESTS 29 46 0
342126672 duelist_1883 D Oct. 5, 2025, 8:25 p.m. OK C++17 (GCC 7-32) TESTS 29 46 102400
342159659 Mihir2502 D Oct. 6, 2025, 5:25 a.m. OK C++17 (GCC 7-32) TESTS 29 61 0
342141707 Paqis D Oct. 6, 2025, 1:22 a.m. OK C++17 (GCC 7-32) TESTS 29 61 0
342141192 Leasier D Oct. 6, 2025, 1:13 a.m. OK C++17 (GCC 7-32) TESTS 29 61 0
342138452 loglikelihood D Oct. 6, 2025, 12:12 a.m. OK C++17 (GCC 7-32) TESTS 29 61 0
342137686 zanj0 D Oct. 5, 2025, 11:47 p.m. OK C++17 (GCC 7-32) TESTS 29 61 0
342136253 Ross2004 D Oct. 5, 2025, 10:59 p.m. OK C++17 (GCC 7-32) TESTS 29 61 0
342127731 Din_ED D Oct. 5, 2025, 8:34 p.m. OK C++17 (GCC 7-32) TESTS 29 61 0
342137224 Ernest0_0Abreu D Oct. 5, 2025, 11:28 p.m. OK C++20 (GCC 13-64) TESTS 29 46 0
342126166 monubhargav D Oct. 5, 2025, 8:20 p.m. OK C++20 (GCC 13-64) TESTS 29 46 0
342142387 Ricky214365 D Oct. 6, 2025, 1:35 a.m. OK C++20 (GCC 13-64) TESTS 29 46 102400
342140795 Andwerp D Oct. 6, 2025, 1:05 a.m. OK C++20 (GCC 13-64) TESTS 29 46 102400
342125361 agr_pranjal D Oct. 5, 2025, 8:14 p.m. OK C++20 (GCC 13-64) TESTS 29 46 102400
342148318 Adp_D D Oct. 6, 2025, 3:04 a.m. OK C++20 (GCC 13-64) TESTS 29 61 0
342144351 srghdgfhjk D Oct. 6, 2025, 2:06 a.m. OK C++20 (GCC 13-64) TESTS 29 61 0
342141099 -zura- D Oct. 6, 2025, 1:11 a.m. OK C++20 (GCC 13-64) TESTS 29 61 0
342137216 ClickBait325 D Oct. 5, 2025, 11:28 p.m. OK C++20 (GCC 13-64) TESTS 29 61 0
342134260 Adi.gain D Oct. 5, 2025, 10:11 p.m. OK C++20 (GCC 13-64) TESTS 29 61 0
342160087 Jayasurya2006 D Oct. 6, 2025, 5:29 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 46 0
342126128 edge_case D Oct. 5, 2025, 8:20 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 46 0
342123812 The_Lion_King_4210 D Oct. 5, 2025, 8:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 46 0
342150977 Dim_Star D Oct. 6, 2025, 3:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 46 102400
342150097 exccc D Oct. 6, 2025, 3:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 46 102400
342129016 nowayjose D Oct. 5, 2025, 8:48 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 46 102400
342155314 Lara_Croft1996_r34 D Oct. 6, 2025, 4:36 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 61 0
342153785 xz432 D Oct. 6, 2025, 4:15 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 61 0
342141753 ltdsword D Oct. 6, 2025, 1:22 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 61 0
342128933 rishirathore214 D Oct. 5, 2025, 8:47 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 61 0
342126152 avighnakc D Oct. 5, 2025, 8:20 p.m. OK GNU C11 TESTS 29 93 8396800
342111507 RANK1ZEN D Oct. 5, 2025, 6:25 p.m. OK Go TESTS 29 108 102400
342115030 kpiyush1024 D Oct. 5, 2025, 6:31 p.m. OK Java 21 TESTS 29 312 1024000
342161378 ccj123 D Oct. 6, 2025, 5:42 a.m. OK Java 21 TESTS 29 327 1024000
342124653 vineetiwari D Oct. 5, 2025, 8:08 p.m. OK Java 21 TESTS 29 327 2150400
342124160 WrongAnswerOnTestCase2 D Oct. 5, 2025, 8:05 p.m. OK Java 21 TESTS 29 327 2457600
342116683 W1ll-Du D Oct. 5, 2025, 6:34 p.m. OK Java 21 TESTS 29 328 1024000
342105317 adii3108 D Oct. 5, 2025, 6:13 p.m. OK Java 21 TESTS 29 342 1126400
342105493 omchaubey_05 D Oct. 5, 2025, 6:14 p.m. OK Java 21 TESTS 29 358 1536000
342110575 Samyajit125 D Oct. 5, 2025, 6:23 p.m. OK Java 21 TESTS 29 359 921600
342154745 Aadi_Gupta D Oct. 6, 2025, 4:28 a.m. OK Java 21 TESTS 29 359 1433600
342116594 surya_vikas_ D Oct. 5, 2025, 6:34 p.m. OK Java 21 TESTS 29 374 1433600
342123939 Eslam_Ahmed D Oct. 5, 2025, 8:03 p.m. OK Java 8 TESTS 29 171 0
342107021 grray_coder D Oct. 5, 2025, 6:17 p.m. OK Java 8 TESTS 29 171 0
342160929 saiashish9 D Oct. 6, 2025, 5:38 a.m. OK Java 8 TESTS 29 187 0
342107688 shikharsinha117 D Oct. 5, 2025, 6:18 p.m. OK Java 8 TESTS 29 187 0
342115346 testtest111ksjfrdvn D Oct. 5, 2025, 6:32 p.m. OK Java 8 TESTS 29 202 0
342104874 SecondThread D Oct. 5, 2025, 6:13 p.m. OK Kotlin 2.2 TESTS 29 187 0
342110499 Anirudhg_027 D Oct. 5, 2025, 6:23 p.m. OK PyPy 3 TESTS 29 124 1536000
342117074 movement124 D Oct. 5, 2025, 6:34 p.m. OK PyPy 3 TESTS 29 124 1638400
342114832 morraconda D Oct. 5, 2025, 6:31 p.m. OK PyPy 3 TESTS 29 139 2252800
342146620 bpdolson D Oct. 6, 2025, 2:40 a.m. OK PyPy 3 TESTS 29 140 1843200
342108780 kra_apnivek D Oct. 5, 2025, 6:20 p.m. OK PyPy 3 TESTS 29 155 1433600
342108489 sathvik_67 D Oct. 5, 2025, 6:19 p.m. OK PyPy 3 TESTS 29 265 5324800
342159787 gardengnome D Oct. 6, 2025, 5:26 a.m. OK PyPy 3-64 TESTS 29 77 0
342154237 ibraheemkureshi D Oct. 6, 2025, 4:20 a.m. OK PyPy 3-64 TESTS 29 93 102400
342158236 CDastrup D Oct. 6, 2025, 5:09 a.m. OK PyPy 3-64 TESTS 29 93 1228800
342155757 Bakytz7zaN D Oct. 6, 2025, 4:42 a.m. OK PyPy 3-64 TESTS 29 93 1331200
342132543 kavorka D Oct. 5, 2025, 9:36 p.m. OK PyPy 3-64 TESTS 29 108 102400
342127846 RobinFromTheHood D Oct. 5, 2025, 8:36 p.m. OK PyPy 3-64 TESTS 29 108 102400
342154177 mtand872 D Oct. 6, 2025, 4:20 a.m. OK PyPy 3-64 TESTS 29 108 1228800
342114391 Jyotier D Oct. 5, 2025, 6:30 p.m. OK PyPy 3-64 TESTS 29 108 1228800
342160958 kamio-misuzu D Oct. 6, 2025, 5:38 a.m. OK PyPy 3-64 TESTS 29 109 0
342127087 Nolirue_Sola D Oct. 5, 2025, 8:28 p.m. OK PyPy 3-64 TESTS 29 109 0
342127487 jvatsal0709 D Oct. 5, 2025, 8:32 p.m. OK Python 3 TESTS 29 62 102400
342117592 Sin_R0str0 D Oct. 5, 2025, 6:34 p.m. OK Python 3 TESTS 29 77 102400
342126005 ffgfgf D Oct. 5, 2025, 8:19 p.m. OK Python 3 TESTS 29 92 102400
342123823 Nikrien D Oct. 5, 2025, 8:03 p.m. OK Python 3 TESTS 29 92 102400
342116880 incheif D Oct. 5, 2025, 6:34 p.m. OK Python 3 TESTS 29 92 102400
342160830 green_maniac D Oct. 6, 2025, 5:37 a.m. OK Python 3 TESTS 29 93 102400
342133401 mudanvit.goyal D Oct. 5, 2025, 9:53 p.m. OK Python 3 TESTS 29 93 102400
342108567 Tetralix D Oct. 5, 2025, 6:19 p.m. OK Python 3 TESTS 29 93 102400
342108783 sirvff D Oct. 5, 2025, 6:20 p.m. OK Python 3 TESTS 29 108 307200
342127967 kon27 D Oct. 5, 2025, 8:37 p.m. OK Python 3 TESTS 29 109 204800
342144928 nonrice D Oct. 6, 2025, 2:15 a.m. OK Rust 2024 TESTS 29 46 0

remove filters

Back to search problems