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
( 2485 ) C2 Interactive RBS (Medium Version) PROGRAMMING binary search bitmasks constructive algorithms interactive

This is an interactive problem. This is the medium 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 (200) 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

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
331805872 KumaTachiRen C2 July 31, 2025, 3:42 p.m. OK C# 13 TESTS 29 218 6144000
331824314 arimxcoder C2 July 31, 2025, 4:16 p.m. OK C++17 (GCC 7-32) TESTS 29 155 102400
331854782 ling_chen C2 July 31, 2025, 5:32 p.m. OK C++17 (GCC 7-32) TESTS 29 156 0
331812953 fangcy C2 July 31, 2025, 3:53 p.m. OK C++17 (GCC 7-32) TESTS 29 156 1024000
331827695 B_3 C2 July 31, 2025, 4:23 p.m. OK C++17 (GCC 7-32) TESTS 29 186 0
331821621 modongtao C2 July 31, 2025, 4:10 p.m. OK C++17 (GCC 7-32) TESTS 29 186 0
331835377 lukamosiashvili C2 July 31, 2025, 4:41 p.m. OK C++17 (GCC 7-32) TESTS 29 186 102400
331812120 konghaojie C2 July 31, 2025, 3:52 p.m. OK C++17 (GCC 7-32) TESTS 29 187 0
331828562 Teja-Smart C2 July 31, 2025, 4:25 p.m. OK C++17 (GCC 7-32) TESTS 29 187 102400
331823596 djs100201 C2 July 31, 2025, 4:14 p.m. OK C++17 (GCC 7-32) TESTS 29 187 102400
331834119 X_Luo C2 July 31, 2025, 4:38 p.m. OK C++17 (GCC 7-32) TESTS 29 202 0
331892896 Carucao C2 Aug. 1, 2025, 3:21 a.m. OK C++20 (GCC 13-64) TESTS 29 108 102400
331837840 Geforgs C2 July 31, 2025, 4:47 p.m. OK C++20 (GCC 13-64) TESTS 29 124 102400
331835730 Ggg_ C2 July 31, 2025, 4:42 p.m. OK C++20 (GCC 13-64) TESTS 29 124 102400
331885977 surajchip2 C2 Aug. 1, 2025, 1:54 a.m. OK C++20 (GCC 13-64) TESTS 29 139 102400
331808964 shqrky C2 July 31, 2025, 3:47 p.m. OK C++20 (GCC 13-64) TESTS 29 139 102400
331846436 2114992323 C2 July 31, 2025, 5:11 p.m. OK C++20 (GCC 13-64) TESTS 29 140 102400
331839875 damianides1000101 C2 July 31, 2025, 4:53 p.m. OK C++20 (GCC 13-64) TESTS 29 140 102400
331833386 AIdk C2 July 31, 2025, 4:36 p.m. OK C++20 (GCC 13-64) TESTS 29 140 102400
331828359 rng.58 C2 July 31, 2025, 4:24 p.m. OK C++20 (GCC 13-64) TESTS 29 140 102400
331813850 wxhtzdy C2 July 31, 2025, 3:55 p.m. OK C++20 (GCC 13-64) TESTS 29 140 102400
331876633 GlobalExpress C2 July 31, 2025, 11:31 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 124 102400
331837952 Cyber C2 July 31, 2025, 4:48 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 139 102400
331841660 Rybka21 C2 July 31, 2025, 4:57 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 140 102400
331836656 OpGm C2 July 31, 2025, 4:44 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 140 102400
331833038 osjoon C2 July 31, 2025, 4:35 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 140 102400
331797633 Mangooste C2 July 31, 2025, 3:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 140 102400
331814526 olmrgcsi C2 July 31, 2025, 3:56 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 140 5939200
331875820 Jasonwei08 C2 July 31, 2025, 11:09 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 155 102400
331833197 deltarune C2 July 31, 2025, 4:36 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 155 102400
331815684 1egend C2 July 31, 2025, 3:58 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 155 102400
331866417 Gassa C2 July 31, 2025, 8:18 p.m. OK D TESTS 29 858 3379200
331811940 Gassa C2 July 31, 2025, 3:52 p.m. OK D TESTS 29 859 3379200
331898598 man-ray C2 Aug. 1, 2025, 4:29 a.m. OK Java 21 TESTS 29 640 1126400
331806288 Lilypad C2 July 31, 2025, 3:42 p.m. OK Java 21 TESTS 29 1624 1843200
331811299 bcollet C2 July 31, 2025, 3:51 p.m. OK PyPy 3-64 TESTS 29 296 4403200
331848544 thewaxmango C2 July 31, 2025, 5:16 p.m. OK PyPy 3-64 TESTS 29 296 9113600
331815260 smilences C2 July 31, 2025, 3:58 p.m. OK PyPy 3-64 TESTS 29 343 4403200
331872117 monocrap C2 July 31, 2025, 9:37 p.m. OK PyPy 3-64 TESTS 29 343 6451200
331873192 monocrap C2 July 31, 2025, 9:58 p.m. OK PyPy 3-64 TESTS 29 343 6553600
331846769 bjcb C2 July 31, 2025, 5:12 p.m. OK PyPy 3-64 TESTS 29 343 7577600
331855910 chinerist C2 July 31, 2025, 5:34 p.m. OK PyPy 3-64 TESTS 29 343 8601600
331854533 eepsilon C2 July 31, 2025, 5:32 p.m. OK PyPy 3-64 TESTS 29 343 8908800
331873397 monocrap C2 July 31, 2025, 10:03 p.m. OK PyPy 3-64 TESTS 29 358 6963200
331817227 baoziiQwQ C2 July 31, 2025, 4:01 p.m. OK PyPy 3-64 TESTS 29 359 8089600
331811647 sansen C2 July 31, 2025, 3:51 p.m. OK Rust 2021 TESTS 29 218 102400
331790869 DanielAnker C2 July 31, 2025, 3:20 p.m. OK Rust 2021 TESTS 29 327 102400
331819423 Sugar_fan C2 July 31, 2025, 4:06 p.m. OK Rust 2021 TESTS 29 343 102400
331787627 Egor C2 July 31, 2025, 3:15 p.m. OK Rust 2021 TESTS 29 406 102400
331828348 Ming_Xu C2 July 31, 2025, 4:24 p.m. OK Rust 2021 TESTS 29 453 102400

remove filters

Back to search problems