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
( 1655 ) C3 Interactive RBS (Hard Version) PROGRAMMING binary search bitmasks constructive algorithms dp interactive

This is an interactive problem. This is the hard 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 (100) 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
331820562 KumaTachiRen C3 July 31, 2025, 4:08 p.m. OK C# 13 TESTS 29 249 6348800
331868358 TrendBattles C3 July 31, 2025, 8:38 p.m. OK C++17 (GCC 7-32) TESTS 29 202 102400
331837823 mon_de2738 C3 July 31, 2025, 4:47 p.m. OK C++17 (GCC 7-32) TESTS 29 203 409600
331823530 fangcy C3 July 31, 2025, 4:14 p.m. OK C++17 (GCC 7-32) TESTS 29 203 1024000
331898757 Mark_Pr C3 Aug. 1, 2025, 4:32 a.m. OK C++17 (GCC 7-32) TESTS 29 218 102400
331875783 lwm7708 C3 July 31, 2025, 11:08 p.m. OK C++17 (GCC 7-32) TESTS 29 218 102400
331820380 leinad2 C3 July 31, 2025, 4:07 p.m. OK C++17 (GCC 7-32) TESTS 29 218 102400
331894333 dwdyy C3 Aug. 1, 2025, 3:37 a.m. OK C++17 (GCC 7-32) TESTS 29 218 819200
331897896 zhoujingchen C3 Aug. 1, 2025, 4:20 a.m. OK C++17 (GCC 7-32) TESTS 29 233 102400
331906464 kian2009 C3 Aug. 1, 2025, 6:04 a.m. OK C++17 (GCC 7-32) TESTS 29 234 409600
331850332 k_balint C3 July 31, 2025, 5:21 p.m. OK C++17 (GCC 7-32) TESTS 29 234 5632000
331896864 fisher199 C3 Aug. 1, 2025, 4:06 a.m. OK C++20 (GCC 13-64) TESTS 29 140 102400
331876688 AlexW08 C3 July 31, 2025, 11:32 p.m. OK C++20 (GCC 13-64) TESTS 29 155 0
331886482 surajchip2 C3 Aug. 1, 2025, 2:02 a.m. OK C++20 (GCC 13-64) TESTS 29 155 102400
331873474 jackson.souza C3 July 31, 2025, 10:04 p.m. OK C++20 (GCC 13-64) TESTS 29 155 102400
331849195 JYJin C3 July 31, 2025, 5:18 p.m. OK C++20 (GCC 13-64) TESTS 29 155 102400
331835027 MrPython C3 July 31, 2025, 4:40 p.m. OK C++20 (GCC 13-64) TESTS 29 155 102400
331884390 Tobo C3 Aug. 1, 2025, 1:32 a.m. OK C++20 (GCC 13-64) TESTS 29 156 102400
331866928 turkhuu622 C3 July 31, 2025, 8:23 p.m. OK C++20 (GCC 13-64) TESTS 29 156 102400
331896717 __baozii__ C3 Aug. 1, 2025, 4:04 a.m. OK C++20 (GCC 13-64) TESTS 29 171 102400
331887026 McPqndq C3 Aug. 1, 2025, 2:10 a.m. OK C++20 (GCC 13-64) TESTS 29 171 102400
331886505 BiaxialRay_ C3 Aug. 1, 2025, 2:02 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 140 38912000
331867638 fishcathu C3 July 31, 2025, 8:30 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 155 102400
331818114 Baraa-Ahmed C3 July 31, 2025, 4:03 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 155 102400
331894938 Joler_ C3 Aug. 1, 2025, 3:44 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 156 0
331875028 DonChipilin C3 July 31, 2025, 10:45 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 156 102400
331866520 NikoBaotic C3 July 31, 2025, 8:19 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 156 102400
331828090 exgcd C3 July 31, 2025, 4:24 p.m. OK C++23 (GCC 14-64, msys2) TESTS 29 156 102400
331895612 fishcathu C3 Aug. 1, 2025, 3:51 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 171 102400
331888314 mhb2010 C3 Aug. 1, 2025, 2:27 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 171 102400
331884435 molongdadi C3 Aug. 1, 2025, 1:33 a.m. OK C++23 (GCC 14-64, msys2) TESTS 29 171 102400
331848432 Gassa C3 July 31, 2025, 5:16 p.m. OK D TESTS 29 593 3379200
331866461 Gassa C3 July 31, 2025, 8:18 p.m. OK D TESTS 29 608 3379200
331869086 Quasicoherent C3 July 31, 2025, 8:47 p.m. OK Java 21 TESTS 29 515 1740800
331898483 man-ray C3 Aug. 1, 2025, 4:28 a.m. OK Java 21 TESTS 29 624 1228800
331814600 Lilypad C3 July 31, 2025, 3:56 p.m. OK Java 21 TESTS 29 1406 1843200
331874643 monocrap C3 July 31, 2025, 10:34 p.m. OK PyPy 3-64 TESTS 29 280 5632000
331854721 eepsilon C3 July 31, 2025, 5:32 p.m. OK PyPy 3-64 TESTS 29 311 8908800
331824205 bcollet C3 July 31, 2025, 4:15 p.m. OK PyPy 3-64 TESTS 29 358 8704000
331846807 bjcb C3 July 31, 2025, 5:12 p.m. OK PyPy 3-64 TESTS 29 374 7475200
331849095 thewaxmango C3 July 31, 2025, 5:18 p.m. OK PyPy 3-64 TESTS 29 374 9011200
331836275 baoziiQwQ C3 July 31, 2025, 4:43 p.m. OK PyPy 3-64 TESTS 29 374 10240000
331845482 toam C3 July 31, 2025, 5:08 p.m. OK PyPy 3-64 TESTS 29 390 10649600
331838442 LMeyling C3 July 31, 2025, 4:49 p.m. OK PyPy 3-64 TESTS 29 405 10240000
331817579 golomb C3 July 31, 2025, 4:02 p.m. OK PyPy 3-64 TESTS 29 421 10240000
331788325 conqueror_of_tourist C3 July 31, 2025, 3:16 p.m. OK PyPy 3-64 TESTS 29 437 8908800
331818755 sansen C3 July 31, 2025, 4:04 p.m. OK Rust 2021 TESTS 29 202 102400
331794954 Egor C3 July 31, 2025, 3:25 p.m. OK Rust 2021 TESTS 29 218 0
331819581 Sugar_fan C3 July 31, 2025, 4:06 p.m. OK Rust 2021 TESTS 29 249 102400
331798088 DanielAnker C3 July 31, 2025, 3:30 p.m. OK Rust 2021 TESTS 29 249 102400
331853442 Ming_Xu C3 July 31, 2025, 5:29 p.m. OK Rust 2021 TESTS 29 406 102400

remove filters

Back to search problems