Codeforces Round 1040 (Div. 1)

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
2129 Codeforces Round 1040 (Div. 1) FINISHED False 10800 22433123 July 31, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 3835 ) C1 Interactive RBS (Easy Version) PROGRAMMING binary search bitmasks constructive algorithms interactive

This is an interactive problem. This is the easy version of the problem. The only difference is the limit on the number of queries. You can make hacks only if all versions of the problem are solved. There is a hidden bracket sequence (s) of length (n), where (s) only contains ('(') and (')'). It is guaranteed that (s) contains at least one ('(') and one (')'). To find this bracket sequence, you can ask queries. Each query has the following form: you pick an integer (k) and arbitrary indices (i_1, i_2, \ldots, i_k) ((1 \le k \le 1000), (1 \le i_1, i_2, \ldots, i_k \le n)). Note that the indices can be equal. Next, you receive an integer (f(s_{i_1}s_{i_2}\ldots s_{i_k})) calculated by the jury. For a bracket sequence (t), (f(t)) is the number of non-empty regular bracket substrings in (t) (the substrings must be contiguous ). For example, (f("()())") = 3). A bracket sequence is called regular if it can be constructed in the following way. The empty sequence (\varnothing) is regular. If the bracket sequence (A) is regular, then (\mathtt{(}A\mathtt{)}) is also regular. If the bracket sequences (A) and (B) are regular, then the concatenated sequence (A B) is also regular. For example, the sequences ("(())()"), ("()") are regular, while ("(()") and ("())(") are not. Find the sequence (s) using no more than (550) queries. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 20)). The description of the test cases follows. The first line of each test case contains one integer (n) ((2 \le n \le 1000)). At this moment, the bracket sequence (s) is chosen. The interactor in this task is not adaptive . In other words, the bracket sequence (s) is fixed in every test case and does not change during th

Tutorials

Codeforces Round 1040 (Div. 1, Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
331805540 KumaTachiRen C1 July 31, 2025, 3:41 p.m. OK C# 13 TESTS 29 312 6144000
331829205 0htoAi C1 July 31, 2025, 4:26 p.m. OK C++17 (GCC 7-32) TESTS 29 139 102400
331888850 honey C1 Aug. 1, 2025, 2:34 a.m. OK C++17 (GCC 7-32) TESTS 29 140 0
331828170 lukamosiashvili C1 July 31, 2025, 4:24 p.m. OK C++17 (GCC 7-32) TESTS 29 140 0
331824328 Ylx22 C1 July 31, 2025, 4:16 p.m. OK C++17 (GCC 7-32) TESTS 29 140 102400
331810769 CrispyLobster C1 July 31, 2025, 3:50 p.m. OK C++17 (GCC 7-32) TESTS 29 140 102400
331884629 che960 C1 Aug. 1, 2025, 1:35 a.m. OK C++17 (GCC 7-32) TESTS 29 155 0
331831111 BenjaR C1 July 31, 2025, 4:31 p.m. OK C++17 (GCC 7-32) TESTS 29 155 0
331798952 leinad2 C1 July 31, 2025, 3:31 p.m. OK C++17 (GCC 7-32) TESTS 29 155 102400
331784244 potato167 C1 July 31, 2025, 3:11 p.m. OK C++17 (GCC 7-32) TESTS 29 155 102400
331804383 fft_ntt C1 July 31, 2025, 3:39 p.m. OK C++17 (GCC 7-32) TESTS 29 156 0
331885885 surajchip2 C1 Aug. 1, 2025, 1:53 a.m. OK C++20 (GCC 13-64) TESTS 29 109 102400
331816326 ShmilyTY C1 July 31, 2025, 3:59 p.m. OK C++20 (GCC 13-64) TESTS 29 124 102400
331813775 Natsuzora C1 July 31, 2025, 3:55 p.m. OK C++20 (GCC 13-64) TESTS 29 124 102400
331904226 lakshyasinghal006 C1 Aug. 1, 2025, 5:41 a.m. OK C++20 (GCC 13-64) TESTS 29 139 102400
331895880 Abdullah500 C1 Aug. 1, 2025, 3:54 a.m. OK C++20 (GCC 13-64) TESTS 29 140 0
331874411 menherachanuwu C1 July 31, 2025, 10:28 p.m. OK C++20 (GCC 13-64) TESTS 29 140 102400
331839831 Yahia_Emara C1 July 31, 2025, 4:53 p.m. OK C++20 (GCC 13-64) TESTS 29 140 102400
331829730 henry192511 C1 July 31, 2025, 4:27 p.m. OK C++20 (GCC 13-64) TESTS 29 140 102400
331828346 MagnusCarlsen321 C1 July 31, 2025, 4:24 p.m. OK C++20 (GCC 13-64) TESTS 29 140 102400
331827889 damianides1000101 C1 July 31, 2025, 4:23 p.m. OK C++20 (GCC 13-64) TESTS 29 140 102400
331829175 Abd C1 July 31, 2025, 4:26 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 124 102400
331797298 Mangooste C1 July 31, 2025, 3:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 124 102400
331814067 ArSarapkin C1 July 31, 2025, 3:56 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 125 102400
331897401 PzzZ C1 Aug. 1, 2025, 4:13 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 139 0
331820567 TheFuturoma C1 July 31, 2025, 4:08 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 139 102400
331905037 Hayashi C1 Aug. 1, 2025, 5:50 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 140 0
331827882 x2026001014 C1 July 31, 2025, 4:23 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 140 0
331821537 nnv-nick C1 July 31, 2025, 4:10 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 140 0
331873684 QuantumHyperflux C1 July 31, 2025, 10:09 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 140 102400
331843308 maguuus C1 July 31, 2025, 5:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 140 102400
331811360 Gassa C1 July 31, 2025, 3:51 p.m. OK D TESTS 29 905 3379200
331866395 Gassa C1 July 31, 2025, 8:17 p.m. OK D TESTS 29 1171 3379200
331810860 pengin_2000 C1 July 31, 2025, 3:50 p.m. OK GNU C11 TESTS 29 187 8396800
331816039 lyongwolf C1 July 31, 2025, 3:59 p.m. OK Java 21 TESTS 29 406 921600
331869046 Quasicoherent C1 July 31, 2025, 8:47 p.m. OK Java 21 TESTS 29 530 3379200
331818209 theSSS C1 July 31, 2025, 4:03 p.m. OK Java 21 TESTS 29 546 1945600
331898604 man-ray C1 Aug. 1, 2025, 4:29 a.m. OK Java 21 TESTS 29 593 1433600
331805476 Lilypad C1 July 31, 2025, 3:41 p.m. OK Java 21 TESTS 29 1562 1843200
331814902 smilences C1 July 31, 2025, 3:57 p.m. OK PyPy 3-64 TESTS 29 358 4505600
331872098 monocrap C1 July 31, 2025, 9:37 p.m. OK PyPy 3-64 TESTS 29 358 6553600
331848006 thewaxmango C1 July 31, 2025, 5:15 p.m. OK PyPy 3-64 TESTS 29 358 8908800
331821426 eepsilon C1 July 31, 2025, 4:10 p.m. OK PyPy 3-64 TESTS 29 390 4403200
331870602 iska_terminator C1 July 31, 2025, 9:10 p.m. OK PyPy 3-64 TESTS 29 390 7168000
331872664 iska_terminator C1 July 31, 2025, 9:48 p.m. OK PyPy 3-64 TESTS 29 405 8908800
331826885 twosquares C1 July 31, 2025, 4:21 p.m. OK PyPy 3-64 TESTS 29 405 10240000
331827191 denk C1 July 31, 2025, 4:22 p.m. OK PyPy 3-64 TESTS 29 406 7065600
331825182 Mukundan314 C1 July 31, 2025, 4:17 p.m. OK PyPy 3-64 TESTS 29 421 6553600
331792926 baoziiQwQ C1 July 31, 2025, 3:22 p.m. OK PyPy 3-64 TESTS 29 421 8294400
331808797 Ming_Xu C1 July 31, 2025, 3:46 p.m. OK Rust 2021 TESTS 29 202 102400
331806838 sansen C1 July 31, 2025, 3:43 p.m. OK Rust 2021 TESTS 29 202 102400
331804425 Sugar_fan C1 July 31, 2025, 3:39 p.m. OK Rust 2021 TESTS 29 265 102400
331788449 DanielAnker C1 July 31, 2025, 3:16 p.m. OK Rust 2021 TESTS 29 421 102400
331786894 Egor C1 July 31, 2025, 3:14 p.m. OK Rust 2021 TESTS 29 452 102400

remove filters

Back to search problems