Codeforces Round 1118 (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
2258 Codeforces Round 1118 (Div. 2) FINISHED False 7200 141884 Aug. 29, 2026, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 253 ) D Magic Tiles PROGRAMMING dp implementation

Magic Tiles is a well-known piano game worldwide, and this problem is based on it. Noyan is not very good at games that require fast reflexes and high concentration. As a result, he can only use a single finger, meaning he can press at most one tile per row. Furthermore, when he presses the same column consecutively, he earns points proportional to the length of his streak. However, if he presses an incorrect tile, he is eliminated. Help Noyan determine the optimal configuration to maximize his score. You are given a grid with (10^{18}) rows and (2) columns. Rows are indexed from (1) to (10^{18}), and columns are indexed (1) and (2). Each cell is colored either white or black. You need to select a subset of black cells such that at most one cell is selected from each row. Your goal is to maximize the total score (S), which is the sum of scores calculated for the first and second columns independently. The score for a single column is defined as () \sum_{i=1}^{k} 100^{100^{x_i}}, () where (k) is the number of maximal contiguous segments of selected cells in that column, and (x_i) represents the length of the (i)-th segment. Determine the largest total score you can get. Since the grid is astronomically large, the input is given in a compressed format of maximal black segments for each column. You also need to provide the answer in a compressed format. For more details, refer to the input and output sections. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 3000)). The description of the test cases follows. The first line of each test case contains two integers (n) and (m) ((1 \le n, m \le 3000)) — the number of segments of black cells in Column 1 and Column 2, respectively. The next (n) lines of each test case contain the black cell segments for Column 1. The (i)-th of these lines contains two integers (l_{1, i}) and $$$r

Tutorials

Codeforces Round 1118 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
388868194 mban259 D Aug. 30, 2026, 3:44 a.m. OK C# 13 TESTS 30 2593 462643200
388830553 its_saras D Aug. 29, 2026, 4:24 p.m. OK C++17 (GCC 7-32) TESTS 30 62 22835200
388833534 sandy1432.sandhya D Aug. 29, 2026, 4:32 p.m. OK C++17 (GCC 7-32) TESTS 30 78 6553600
388821491 chandler176 D Aug. 29, 2026, 3:57 p.m. OK C++17 (GCC 7-32) TESTS 30 93 0
388844457 aadits83_off D Aug. 29, 2026, 6:11 p.m. OK C++17 (GCC 7-32) TESTS 30 93 102400
388831330 JeffreyLee D Aug. 29, 2026, 4:26 p.m. OK C++17 (GCC 7-32) TESTS 30 93 204800
388822753 BiNau D Aug. 29, 2026, 4:01 p.m. OK C++17 (GCC 7-32) TESTS 30 109 102400
388833505 stapler D Aug. 29, 2026, 4:32 p.m. OK C++17 (GCC 7-32) TESTS 30 109 1638400
388828501 Scahispo_ D Aug. 29, 2026, 4:18 p.m. OK C++17 (GCC 7-32) TESTS 30 125 0
388832481 intjr D Aug. 29, 2026, 4:29 p.m. OK C++17 (GCC 7-32) TESTS 30 125 102400
388829606 Bug__Exorcist D Aug. 29, 2026, 4:21 p.m. OK C++17 (GCC 7-32) TESTS 30 125 102400
388832422 SupperX D Aug. 29, 2026, 4:29 p.m. OK C++20 (GCC 13-64) TESTS 30 78 102400
388825748 donguyenduykhang012340 D Aug. 29, 2026, 4:10 p.m. OK C++20 (GCC 13-64) TESTS 30 78 5836800
388840222 realrukashi D Aug. 29, 2026, 5:27 p.m. OK C++20 (GCC 13-64) TESTS 30 78 37683200
388844356 deeptanshuyadav4 D Aug. 29, 2026, 6:10 p.m. OK C++20 (GCC 13-64) TESTS 30 93 0
388832056 GrandMasterRED D Aug. 29, 2026, 4:28 p.m. OK C++20 (GCC 13-64) TESTS 30 93 1228800
388853399 Justinshao D Aug. 29, 2026, 7:44 p.m. OK C++20 (GCC 13-64) TESTS 30 109 102400
388831450 Man0fCode D Aug. 29, 2026, 4:26 p.m. OK C++20 (GCC 13-64) TESTS 30 109 102400
388829439 pipo1961 D Aug. 29, 2026, 4:21 p.m. OK C++20 (GCC 13-64) TESTS 30 109 102400
388864569 Dark__Seith D Aug. 30, 2026, 1:49 a.m. OK C++20 (GCC 13-64) TESTS 30 125 102400
388821531 Beyound_Singularity D Aug. 29, 2026, 3:57 p.m. OK C++20 (GCC 13-64) TESTS 30 125 102400
388840704 SadCoder0_0 D Aug. 29, 2026, 5:32 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 78 102400
388828268 priyu_1110 D Aug. 29, 2026, 4:17 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 78 6553600
388830544 BugMakerPro D Aug. 29, 2026, 4:24 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 93 0
388828314 hitarth2737 D Aug. 29, 2026, 4:17 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 93 0
388824228 niike0goood D Aug. 29, 2026, 4:05 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 93 102400
388822403 mohamedeltair D Aug. 29, 2026, 4 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 93 1843200
388840356 __Ahmed__Ashraf__ D Aug. 29, 2026, 5:29 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 109 102400
388833813 onlyfanz D Aug. 29, 2026, 4:33 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 109 102400
388832871 shashankk D Aug. 29, 2026, 4:30 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 109 102400
388825419 aetherion69 D Aug. 29, 2026, 4:09 p.m. OK C++23 (GCC 14-64, msys2) TESTS 30 109 102400
388848726 rainboy D Aug. 29, 2026, 6:35 p.m. OK GNU C11 TESTS 30 140 1331200
388840306 pratthu45 D Aug. 29, 2026, 5:28 p.m. OK Java 21 TESTS 30 375 78643200
388826035 sachin-123 D Aug. 29, 2026, 4:10 p.m. OK Java 21 TESTS 30 421 1433600
388826942 Sarthak1712 D Aug. 29, 2026, 4:13 p.m. OK Java 21 TESTS 30 437 460595200
388861204 Aaryan99 D Aug. 29, 2026, 11:16 p.m. OK Java 21 TESTS 30 515 355225600
388833587 winanhle D Aug. 29, 2026, 4:32 p.m. OK Java 21 TESTS 30 609 439808000
388828415 u1krsh D Aug. 29, 2026, 4:18 p.m. OK Java 21 TESTS 30 1500 1331200
388824184 Piyusha D Aug. 29, 2026, 4:05 p.m. OK Java 8 TESTS 30 406 0
388827869 HemantBatra5 D Aug. 29, 2026, 4:16 p.m. OK Java 8 TESTS 30 593 434073600
388831226 CherryPick D Aug. 29, 2026, 4:26 p.m. OK Java 8 TESTS 30 3437 102400
388859103 alexenkovova D Aug. 29, 2026, 9:57 p.m. OK PyPy 3-64 TESTS 30 343 15769600
388875008 code.demon D Aug. 30, 2026, 5:59 a.m. OK PyPy 3-64 TESTS 30 937 12185600
388821675 Anna_243 D Aug. 29, 2026, 3:58 p.m. OK PyPy 3-64 TESTS 30 953 11673600
388844310 chocolate_cookie D Aug. 29, 2026, 6:10 p.m. OK PyPy 3-64 TESTS 30 968 12390400
388837133 EliteCoder_77 D Aug. 29, 2026, 4:58 p.m. OK PyPy 3-64 TESTS 30 1031 10444800
388830600 Pulkit_gupta D Aug. 29, 2026, 4:24 p.m. OK PyPy 3-64 TESTS 30 1796 14848000
388828381 dyixiao D Aug. 29, 2026, 4:17 p.m. OK PyPy 3-64 TESTS 30 3453 17203200
388829951 charanteja9140 D Aug. 29, 2026, 4:22 p.m. OK Python 3 TESTS 30 140 6246400
388825042 raakh_21 D Aug. 29, 2026, 4:08 p.m. OK Python 3 TESTS 30 468 8704000
388829753 Ravnik D Aug. 29, 2026, 4:22 p.m. OK Rust 2024 TESTS 30 62 26828800

remove filters

Back to search problems