Codeforces Round 996 (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
2055 Codeforces Round 996 (Div. 2) FINISHED False 7200 39713123 Jan. 12, 2025, 2:35 p.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 17180 ) C The Trail PROGRAMMING constructive algorithms greedy math

In the wilderness lies a region of mountainous terrain represented as a rectangular grid with (n) rows and (m) columns. Each cell in the grid is identified by its position ((i, j)), where (i) is the row index and (j) is the column index. The altitude of cell ((i, j)) is denoted by (a_{i,j}). However, this region has been tampered with. A path consisting of (n + m - 1) cells, starting from the top-left corner ((1, 1)) and ending at the bottom-right corner ((n, m)), has been cleared. For every cell ((i, j)) along this path, the altitude (a_{i,j}) has been set to (0). The path moves strictly via downward ((\mathtt{D})) or rightward ((\mathtt{R})) steps. To restore the terrain to its original state, it is known that the region possessed a magical property before it was tampered with: all rows and all columns shared the same sum of altitudes. More formally, there exists an integer (x) such that (\sum_{j=1}^m a_{i, j} = x) for all (1\le i\le n), and (\sum_{i=1}^n a_{i, j} = x) for all (1\le j\le m). Your task is to assign new altitudes to the cells on the path such that the above magical property is restored. It can be proven that a solution always exists. If there are multiple solutions that satisfy the property, any one of them may be provided. Each test contains multiple test cases. The first line contains the number of test cases (t) ((1 \le t \le 10^4)). The description of the test cases follows. The first line of each test case contains two integers (n) and (m) ((2 \leq n, m \leq 1000)) — the number of rows and columns in the grid. The second line of each test case contains a string (s) of length (n+m-2) ((s_i = \mathtt{D}) or (s_i = \mathtt{R})) — the steps the path makes from ((1, 1)) to ((n, m)). The character (\mathtt{D}) represents a downward step, and (\mathtt{R}) represents a rightward step. The (i)-th of the next $

Tutorials

Codeforces Round 996 (Div. 2) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
300768252 khamaza C Jan. 12, 2025, 9:06 p.m. OK C# 10 TESTS 20 264 44032000
300767161 khamaza C Jan. 12, 2025, 8:42 p.m. OK C# 10 TESTS 20 312 14131200
300762643 Dimon2305 C Jan. 12, 2025, 7:31 p.m. OK C# 10 TESTS 20 359 15462400
300771902 calmtrout C Jan. 12, 2025, 10:52 p.m. OK C# 10 TESTS 20 656 15257600
300750197 lamboktulus1379 C Jan. 12, 2025, 5:39 p.m. OK C# 10 TESTS 20 1296 14540800
300742204 Jit_2203127 C Jan. 12, 2025, 4:25 p.m. OK C# 10 TESTS 20 1312 15974400
300769559 god-knows-who C Jan. 12, 2025, 9:39 p.m. OK C++17 (GCC 7-32) TESTS 20 217 16076800
300742451 berricto C Jan. 12, 2025, 4:25 p.m. OK C++17 (GCC 7-32) TESTS 20 374 13516800
300786471 kunxl.gg C Jan. 13, 2025, 4:36 a.m. OK C++17 (GCC 7-32) TESTS 20 406 4710400
300771288 BenjaminJ C Jan. 12, 2025, 10:31 p.m. OK C++17 (GCC 7-32) TESTS 20 406 4915200
300766749 Dancis C Jan. 12, 2025, 8:34 p.m. OK C++17 (GCC 7-32) TESTS 20 406 4915200
300790162 RohitRKS C Jan. 13, 2025, 5:23 a.m. OK C++17 (GCC 7-32) TESTS 20 421 4300800
300790469 kaptaann C Jan. 13, 2025, 5:27 a.m. OK C++17 (GCC 7-32) TESTS 20 421 4300800
300789087 BaiLi_nya C Jan. 13, 2025, 5:10 a.m. OK C++17 (GCC 7-32) TESTS 20 421 4300800
300779572 lazyAlgo C Jan. 13, 2025, 2:51 a.m. OK C++17 (GCC 7-32) TESTS 20 421 4403200
300766182 GandeevDhari C Jan. 12, 2025, 8:25 p.m. OK C++17 (GCC 7-32) TESTS 20 421 4505600
300781037 position1324 C Jan. 13, 2025, 3:16 a.m. OK C++20 (GCC 13-64) TESTS 20 265 4403200
300769544 rg_13471 C Jan. 12, 2025, 9:39 p.m. OK C++20 (GCC 13-64) TESTS 20 265 4403200
300781297 llllhhaaoookkkk. C Jan. 13, 2025, 3:20 a.m. OK C++20 (GCC 13-64) TESTS 20 265 5120000
300786417 PoLaRbEaR_ C Jan. 13, 2025, 4:35 a.m. OK C++20 (GCC 13-64) TESTS 20 265 5120000
300783756 -200 C Jan. 13, 2025, 3:58 a.m. OK C++20 (GCC 13-64) TESTS 20 265 5120000
300783097 lvlian C Jan. 13, 2025, 3:49 a.m. OK C++20 (GCC 13-64) TESTS 20 265 5120000
300781970 wxgmjfhy C Jan. 13, 2025, 3:30 a.m. OK C++20 (GCC 13-64) TESTS 20 265 5120000
300781694 yltzzz C Jan. 13, 2025, 3:26 a.m. OK C++20 (GCC 13-64) TESTS 20 265 5120000
300777180 YoussefSobhy30 C Jan. 13, 2025, 1:57 a.m. OK C++20 (GCC 13-64) TESTS 20 265 5120000
300775492 omkar_p21 C Jan. 13, 2025, 1:13 a.m. OK C++20 (GCC 13-64) TESTS 20 265 5120000
300778650 Kagarii22 C Jan. 13, 2025, 2:31 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 280 5222400
300779544 VangTruong C Jan. 13, 2025, 2:50 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 280 5222400
300779240 VangTruong C Jan. 13, 2025, 2:44 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 280 5222400
300778250 jackylova_fan_fan_fan C Jan. 13, 2025, 2:22 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 280 5222400
300751343 xor_cat C Jan. 12, 2025, 5:43 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 280 5222400
300768165 screenl C Jan. 12, 2025, 9:04 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 280 8089600
300774480 cfls_dpfs C Jan. 13, 2025, 12:39 a.m. OK C++23 (GCC 14-64, msys2) TESTS 20 280 32460800
300755730 HassanAdel0 C Jan. 12, 2025, 6:15 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 281 4403200
300764661 ybhbvb C Jan. 12, 2025, 8 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 281 4403200
300742447 Bhavya2805 C Jan. 12, 2025, 4:25 p.m. OK C++23 (GCC 14-64, msys2) TESTS 20 281 4505600
300744591 ok12 C Jan. 12, 2025, 4:30 p.m. OK C# 8 TESTS 20 1296 15155200
300786692 MaxwellN C Jan. 13, 2025, 4:39 a.m. OK GNU C11 TESTS 20 421 8192000
300760197 aayush01x C Jan. 12, 2025, 7:01 p.m. OK GNU C11 TESTS 20 452 8089600
300750868 Tania_Nawyaj C Jan. 12, 2025, 5:41 p.m. OK Java 21 TESTS 20 499 52940800
300759808 sinnay C Jan. 12, 2025, 6:57 p.m. OK Java 21 TESTS 20 514 6963200
300746889 ChrizzyB47 C Jan. 12, 2025, 4:34 p.m. OK Java 21 TESTS 20 577 7270400
300742787 Fortius C Jan. 12, 2025, 4:26 p.m. OK Java 21 TESTS 20 578 28979200
300776034 let_me_Ac2 C Jan. 13, 2025, 1:29 a.m. OK Java 21 TESTS 20 593 7680000
300786258 dhruvmalhotra2005 C Jan. 13, 2025, 4:33 a.m. OK Java 21 TESTS 20 593 29184000
300746147 harshmishra05672 C Jan. 12, 2025, 4:33 p.m. OK Java 21 TESTS 20 593 29184000
300764870 Divyam05 C Jan. 12, 2025, 8:03 p.m. OK Java 21 TESTS 20 608 29696000
300791582 Coder_GEAR5 C Jan. 13, 2025, 5:40 a.m. OK Java 21 TESTS 20 639 29388800
300764705 jayeshgoel74 C Jan. 12, 2025, 8:01 p.m. OK Java 21 TESTS 20 656 7168000
300767073 infinite_oo_loop C Jan. 12, 2025, 8:40 p.m. OK Java 8 TESTS 20 499 50790400
300763727 Ashank305 C Jan. 12, 2025, 7:46 p.m. OK Java 8 TESTS 20 499 51712000
300770916 alibaba C Jan. 12, 2025, 10:18 p.m. OK Java 8 TESTS 20 515 5632000
300773568 Rajatmah26 C Jan. 13, 2025, midnight OK Java 8 TESTS 20 577 5734400
300742279 pavan.nagaraju94 C Jan. 12, 2025, 4:25 p.m. OK Java 8 TESTS 20 624 5529600
300790664 CodeWode C Jan. 13, 2025, 5:29 a.m. OK Java 8 TESTS 20 687 5836800
300741600 Shitij123 C Jan. 12, 2025, 4:24 p.m. OK Java 8 TESTS 20 1515 51404800
300765875 kasiru_69 C Jan. 12, 2025, 8:19 p.m. OK Java 8 TESTS 20 1561 51302400
300765619 kasiru_69 C Jan. 12, 2025, 8:15 p.m. OK Java 8 TESTS 20 1562 51302400
300789562 deepsalunkhee C Jan. 13, 2025, 5:16 a.m. OK Java 8 TESTS 20 1640 51302400
300770603 L-S-S C Jan. 12, 2025, 10:09 p.m. OK Kotlin 1.9 TESTS 20 890 34201600
300758176 littlegenss C Jan. 12, 2025, 6:39 p.m. OK Kotlin 1.9 TESTS 20 968 25088000
300754424 _Vicky_ C Jan. 12, 2025, 6:04 p.m. OK PyPy 3 TESTS 20 1515 43110400
300766897 benz_19 C Jan. 12, 2025, 8:37 p.m. OK PyPy 3 TESTS 20 1640 48742400
300741924 2023csb1115 C Jan. 12, 2025, 4:24 p.m. OK PyPy 3 TESTS 20 1671 27545600
300740934 pTaran17 C Jan. 12, 2025, 4:22 p.m. OK PyPy 3 TESTS 20 1765 80281600
300750412 _PD_ C Jan. 12, 2025, 5:39 p.m. OK PyPy 3 TESTS 20 1937 38400000
300768376 smilence C Jan. 12, 2025, 9:09 p.m. OK PyPy 3-64 TESTS 20 280 43520000
300745645 4yu5h_ C Jan. 12, 2025, 4:32 p.m. OK PyPy 3-64 TESTS 20 327 16588800
300750719 x3mka C Jan. 12, 2025, 5:41 p.m. OK PyPy 3-64 TESTS 20 327 18124800
300765002 MightyKot C Jan. 12, 2025, 8:05 p.m. OK PyPy 3-64 TESTS 20 328 40857600
300772307 wuguanghaik6 C Jan. 12, 2025, 11:08 p.m. OK PyPy 3-64 TESTS 20 343 42188800
300777768 udayan8 C Jan. 13, 2025, 2:11 a.m. OK PyPy 3-64 TESTS 20 343 43622400
300753022 qcpy C Jan. 12, 2025, 5:54 p.m. OK PyPy 3-64 TESTS 20 358 23142400
300761133 sushmanth.dampur8780 C Jan. 12, 2025, 7:12 p.m. OK PyPy 3-64 TESTS 20 358 50176000
300750150 Om_Singh_ C Jan. 12, 2025, 5:39 p.m. OK PyPy 3-64 TESTS 20 359 16793600
300750883 iska_terminator C Jan. 12, 2025, 5:41 p.m. OK PyPy 3-64 TESTS 20 359 18944000
300755475 akioweh C Jan. 12, 2025, 6:13 p.m. OK Python 3 TESTS 20 671 43417600
300789749 shirshendu_sg C Jan. 13, 2025, 5:18 a.m. OK Python 3 TESTS 20 687 41779200
300784015 KingOfThisWorld C Jan. 13, 2025, 4:02 a.m. OK Python 3 TESTS 20 733 42188800
300773534 Rajatmah26 C Jan. 12, 2025, 11:58 p.m. OK Python 3 TESTS 20 750 42291200
300773494 RM26 C Jan. 12, 2025, 11:57 p.m. OK Python 3 TESTS 20 750 42291200
300743063 nav_01 C Jan. 12, 2025, 4:27 p.m. OK Python 3 TESTS 20 764 42291200
300743402 samagra78 C Jan. 12, 2025, 4:27 p.m. OK Python 3 TESTS 20 843 42598400
300742253 shrmx C Jan. 12, 2025, 4:25 p.m. OK Python 3 TESTS 20 890 52531200
300754313 ywmywm123 C Jan. 12, 2025, 6:03 p.m. OK Python 3 TESTS 20 921 51404800
300750394 orazbek C Jan. 12, 2025, 5:39 p.m. OK Python 3 TESTS 20 968 43622400
300770463 Arjoban C Jan. 12, 2025, 10:04 p.m. OK Rust 2021 TESTS 20 155 22220800
300768231 Singu_Larity C Jan. 12, 2025, 9:06 p.m. OK Rust 2021 TESTS 20 156 5427200
300771526 ziggy C Jan. 12, 2025, 10:39 p.m. OK Rust 2021 TESTS 20 249 5120000
300739580 RYUK1807 C Jan. 12, 2025, 4:19 p.m. OK Rust 2021 TESTS 20 281 4915200
300739668 xiongfeng416 C Jan. 12, 2025, 4:19 p.m. OK Rust 2021 TESTS 20 296 6041600
300760341 Error503 C Jan. 12, 2025, 7:03 p.m. OK Rust 2021 TESTS 20 296 6246400
300762667 the_mmed C Jan. 12, 2025, 7:31 p.m. OK Rust 2021 TESTS 20 296 6656000
300760088 Error503 C Jan. 12, 2025, 7 p.m. OK Rust 2021 TESTS 20 311 6348800
300759474 Error503 C Jan. 12, 2025, 6:53 p.m. OK Rust 2021 TESTS 20 312 5836800
300744072 posiedon_7 C Jan. 12, 2025, 4:29 p.m. OK Scala TESTS 20 1250 70041600

remove filters

Back to search problems