Codeforces Round 1078 (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
2194 Codeforces Round 1078 (Div. 2) FINISHED False 7200 5864123 Feb. 8, 2026, 9:05 a.m.

Problems

Solved
Index
Name
Type
Tags
Community Tag
Rating
( 7685 ) D Table Cut PROGRAMMING constructive algorithms greedy

Given a table of size (n \times m), where each cell contains either (0) or (1). The task is to divide it into two parts with a cut that goes from the top left corner to the bottom right corner. The cut lines can only go right or down. Let (a) be the number of ones in one part of the table after the cut, and (b) be the number of ones in the other part of the table. The goal is to maximize the value of (a \cdot b). 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) ((1 \leq n, m \leq 3 \cdot 10^{5}), (2 \leq n \cdot m \leq 3 \cdot 10^{5})) — the number of rows and columns in the table, respectively. Each of the following (n) lines contains (m) integers, where the (j)-th number in the (i)-th line corresponds to the value (a_{i, j}) ((0 \leq a_{i, j} \leq 1)). It is guaranteed that the sum of (n \cdot m) across all test cases does not exceed (3 \cdot 10^{5}). For each test case, output a single number in the first line of the output data — the maximum value of the product. In the second line, output a string consisting of (n) characters ' D ' and (m) characters ' R ', representing the direction of the next cut, where ' D ' means a cut downwards, and ' R ' — a cut to the right. The images show the correct cuts for each of the first and second test cases, at which the maximum value of the product is achieved.

Tutorials

Codeforces Round #1078 Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
362055278 papa_joo D Feb. 8, 2026, 8:28 p.m. OK C# 13 TESTS 27 187 48435200
362071555 Mustafo D Feb. 9, 2026, 3:31 a.m. OK C++17 (GCC 7-32) TESTS 27 46 102400
361996137 daniboybye D Feb. 8, 2026, 10:56 a.m. OK C++17 (GCC 7-32) TESTS 27 62 4096000
361999940 bstopczynski D Feb. 8, 2026, 11:04 a.m. OK C++17 (GCC 7-32) TESTS 27 62 5427200
362031006 lazysapien D Feb. 8, 2026, 4:22 p.m. OK C++17 (GCC 7-32) TESTS 27 78 0
362023915 kk1213g D Feb. 8, 2026, 3:22 p.m. OK C++17 (GCC 7-32) TESTS 27 78 0
362020304 BaiLi_nya D Feb. 8, 2026, 2:56 p.m. OK C++17 (GCC 7-32) TESTS 27 78 0
361999993 sanskarsovitkaredison934 D Feb. 8, 2026, 11:04 a.m. OK C++17 (GCC 7-32) TESTS 27 78 0
362073892 Siyam_Talukder D Feb. 9, 2026, 4:12 a.m. OK C++17 (GCC 7-32) TESTS 27 78 102400
362070344 shihab_sharar D Feb. 9, 2026, 3:08 a.m. OK C++17 (GCC 7-32) TESTS 27 78 102400
362033724 Nirupam D Feb. 8, 2026, 4:46 p.m. OK C++17 (GCC 7-32) TESTS 27 78 614400
362048396 yogi3926 D Feb. 8, 2026, 6:54 p.m. OK C++20 (GCC 13-64) TESTS 27 46 102400
362061842 DmitriyLukanskiy D Feb. 8, 2026, 11:05 p.m. OK C++20 (GCC 13-64) TESTS 27 62 921600
362070519 kent2017kt D Feb. 9, 2026, 3:11 a.m. OK C++20 (GCC 13-64) TESTS 27 62 2457600
362076560 dev52 D Feb. 9, 2026, 4:54 a.m. OK C++20 (GCC 13-64) TESTS 27 78 0
362080435 CorgiHere D Feb. 9, 2026, 5:44 a.m. OK C++20 (GCC 13-64) TESTS 27 78 102400
362072945 Satyam2106 D Feb. 9, 2026, 3:56 a.m. OK C++20 (GCC 13-64) TESTS 27 78 102400
362063415 elsantodel90 D Feb. 9, 2026, 12:03 a.m. OK C++20 (GCC 13-64) TESTS 27 78 102400
362046978 MeetJasoliya D Feb. 8, 2026, 6:38 p.m. OK C++20 (GCC 13-64) TESTS 27 78 102400
362078527 Riyon D Feb. 9, 2026, 5:20 a.m. OK C++20 (GCC 13-64) TESTS 27 78 716800
362028113 SocialPanda D Feb. 8, 2026, 3:56 p.m. OK C++20 (GCC 13-64) TESTS 27 78 921600
361996703 jn_275 D Feb. 8, 2026, 10:57 a.m. OK C++23 (GCC 14-64, msys2) TESTS 27 46 1126400
362043282 mayankt45 D Feb. 8, 2026, 6:02 p.m. OK C++23 (GCC 14-64, msys2) TESTS 27 46 29081600
362047652 smit_jain D Feb. 8, 2026, 6:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 27 62 2048000
362079140 linjunkai D Feb. 9, 2026, 5:29 a.m. OK C++23 (GCC 14-64, msys2) TESTS 27 62 2457600
362062643 fengzhaoyu D Feb. 8, 2026, 11:36 p.m. OK C++23 (GCC 14-64, msys2) TESTS 27 62 4096000
362033671 ooyeahh D Feb. 8, 2026, 4:46 p.m. OK C++23 (GCC 14-64, msys2) TESTS 27 62 10035200
362054322 Mr_Bald D Feb. 8, 2026, 8:12 p.m. OK C++23 (GCC 14-64, msys2) TESTS 27 62 14540800
362079427 ahmedtemsah D Feb. 9, 2026, 5:32 a.m. OK C++23 (GCC 14-64, msys2) TESTS 27 62 24064000
362078990 Lubna-Sadia D Feb. 9, 2026, 5:26 a.m. OK C++23 (GCC 14-64, msys2) TESTS 27 78 0
362046692 vaibhavdeeptmurty D Feb. 8, 2026, 6:35 p.m. OK C++23 (GCC 14-64, msys2) TESTS 27 78 0
362032849 ruban D Feb. 8, 2026, 4:38 p.m. OK FPC TESTS 27 140 12902400
362043997 1435730 D Feb. 8, 2026, 6:08 p.m. OK GNU C11 TESTS 27 78 1228800
362020789 LittleGopher D Feb. 8, 2026, 2:59 p.m. OK Go TESTS 27 109 11366400
362021591 LittleGopher D Feb. 8, 2026, 3:05 p.m. OK Go TESTS 27 125 11366400
362025576 lybord D Feb. 8, 2026, 3:35 p.m. OK Java 21 TESTS 27 203 5836800
361999756 mastacoda D Feb. 8, 2026, 11:04 a.m. OK Java 21 TESTS 27 218 6451200
362024321 RahulAhuja2901 D Feb. 8, 2026, 3:25 p.m. OK Java 21 TESTS 27 250 5836800
362061985 Bogys D Feb. 8, 2026, 11:10 p.m. OK Java 21 TESTS 27 250 8089600
361997837 Ayusharma17 D Feb. 8, 2026, 11 a.m. OK Java 21 TESTS 27 265 6758400
361995491 888krishnam D Feb. 8, 2026, 10:54 a.m. OK Java 21 TESTS 27 265 6758400
361998546 cherry1009 D Feb. 8, 2026, 11:02 a.m. OK Java 21 TESTS 27 265 17715200
361999615 naman2277 D Feb. 8, 2026, 11:04 a.m. OK Java 21 TESTS 27 281 6451200
362061967 Bogys D Feb. 8, 2026, 11:09 p.m. OK Java 21 TESTS 27 296 5836800
362041517 InvariantCut D Feb. 8, 2026, 5:46 p.m. OK Java 21 TESTS 27 296 7065600
362018732 kevin_0911 D Feb. 8, 2026, 2:45 p.m. OK Java 8 TESTS 27 187 3993600
361994564 officialsathwikram D Feb. 8, 2026, 10:52 a.m. OK Java 8 TESTS 27 468 37171200
361998420 jayavardhanyadav4444 D Feb. 8, 2026, 11:01 a.m. OK Java 8 TESTS 27 500 74035200
362021286 den1107 D Feb. 8, 2026, 3:03 p.m. OK Kotlin 2.2 TESTS 27 203 18124800
361998648 dreamtime D Feb. 8, 2026, 11:02 a.m. OK Kotlin 2.2 TESTS 27 296 26521600
362027816 Homka_666 D Feb. 8, 2026, 3:53 p.m. OK Node.js TESTS 27 359 92672000
362075049 karthik252 D Feb. 9, 2026, 4:30 a.m. OK PyPy 3 TESTS 27 937 26828800
362038868 Lakshay_Arya D Feb. 8, 2026, 5:22 p.m. OK PyPy 3 TESTS 27 1000 26828800
361994434 SuryaPrakashMC D Feb. 8, 2026, 10:52 a.m. OK PyPy 3 TESTS 27 1937 194764800
362047942 jvatsal0709 D Feb. 8, 2026, 6:49 p.m. OK PyPy 3-64 TESTS 27 203 45056000
362057725 PiMat_ D Feb. 8, 2026, 9:15 p.m. OK PyPy 3-64 TESTS 27 218 38809600
361995189 jagannathpisharody D Feb. 8, 2026, 10:54 a.m. OK PyPy 3-64 TESTS 27 218 44851200
362056371 _samit_ D Feb. 8, 2026, 8:47 p.m. OK PyPy 3-64 TESTS 27 218 49561600
361995897 Le_Noh_Hameru D Feb. 8, 2026, 10:56 a.m. OK PyPy 3-64 TESTS 27 234 47001600
362025343 _Blackfyre_ D Feb. 8, 2026, 3:33 p.m. OK PyPy 3-64 TESTS 27 234 59596800
362031366 tealab D Feb. 8, 2026, 4:25 p.m. OK PyPy 3-64 TESTS 27 234 70451200
362048492 Sheikah D Feb. 8, 2026, 6:55 p.m. OK PyPy 3-64 TESTS 27 250 41472000
362064973 OAY71011 D Feb. 9, 2026, 12:52 a.m. OK PyPy 3-64 TESTS 27 250 64921600
362028579 yiren D Feb. 8, 2026, 4 p.m. OK PyPy 3-64 TESTS 27 265 39014400
362078034 harishkeerthimaans D Feb. 9, 2026, 5:14 a.m. OK Python 3 TESTS 27 171 36454400
361994027 anirudh_08 D Feb. 8, 2026, 10:51 a.m. OK Python 3 TESTS 27 343 46080000
362076258 rp185918 D Feb. 9, 2026, 4:50 a.m. OK Python 3 TESTS 27 390 33792000
361997096 vsvsvsarma D Feb. 8, 2026, 10:58 a.m. OK Python 3 TESTS 27 390 53555200
362066509 Ne_xt_ D Feb. 9, 2026, 1:41 a.m. OK Python 3 TESTS 27 437 37376000
362070516 sightf123 D Feb. 9, 2026, 3:11 a.m. OK Python 3 TESTS 27 453 61644800
361993627 FerryMan27 D Feb. 8, 2026, 10:50 a.m. OK Python 3 TESTS 27 640 37683200
362028866 javoh1964 D Feb. 8, 2026, 4:02 p.m. OK Python 3 TESTS 27 656 35123200
361998600 rudr_8 D Feb. 8, 2026, 11:02 a.m. OK Python 3 TESTS 27 703 36659200
362066873 _annhien_ D Feb. 9, 2026, 1:52 a.m. OK Python 3 TESTS 27 906 142540800
362064374 despair D Feb. 9, 2026, 12:33 a.m. OK Rust 2024 TESTS 27 62 19865600
362023354 blaharl D Feb. 8, 2026, 3:18 p.m. OK Rust 2024 TESTS 27 140 24166400
362062866 weiqizheng D Feb. 8, 2026, 11:44 p.m. OK Rust 2024 TESTS 27 156 21811200

remove filters

Back to search problems