Codeforces Round 952 (Div. 4)

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
1985 Codeforces Round 952 (Div. 4) FINISHED False 9000 19063463 June 11, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 1582 ) H2 Maximize the Largest Component (Hard Version) PROGRAMMING data structures dfs and similar ds implementation

B"Easy and hard versions are actually different problems, so read statements of both problems completely and carefully. The only difference between the two versions is the operation. Alex has a grid with n rows and m columns consisting of '.' and '#' characters. A set of '#' cells forms a connected component if from any cell in this set, it is possible to reach any other cell in this set by only moving to another cell in the set that shares a common side. The size of a connected component is the number of cells in the set. In one operation, Alex selects any row r ( 1 <= r <= n ) and any column c ( 1 <= c <= m ), then sets every cell in row r and column c to be '#'. Help Alex find the maximum possible size of the largest connected component of '#' cells that he can achieve after performing the operation at most once. The first line of the input contains a single integer t ( 1 <= q t <= q 10^4 ) -- the number of test cases. The first line of each test case contains two integers n and m ( 1 <= n cdot m <= 10^6 ) -- the number of rows and columns of the grid. The next n lines each contain m characters. Each character is either '.' or '#'. It is guaranteed that the sum of n cdot m over all test cases does not exceed 10^6 . For each test case, output a single integer -- the maximum possible size of a connected component of '#' cells that Alex can achieve. In the fourth test case, it is optimal for Alex to set all cells in row 4 and column 2 to be '#'. Doing so will lead to the largest connected component of '#' having a size of 16 . In the fifth test case, it is optimal for Alex to set all cells in row 2 and column 4 to be '#'. Doing so will lead to the largest connected component of '#' having a size of 22 . "...

Tutorials

Codeforces Round 952 (Div. 4) Editorial

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
265391793 kokokuro H2 June 11, 2024, 5:42 p.m. OK C++14 (GCC 6-32) TESTS 23 1811 217600000
265408355 sdyakonov H2 June 11, 2024, 8:17 p.m. OK C++17 (GCC 7-32) TESTS 23 265 96665600
265410571 pma2u H2 June 11, 2024, 8:47 p.m. OK C++17 (GCC 7-32) TESTS 23 281 77107200
265443953 Rating_10101010 H2 June 12, 2024, 6:01 a.m. OK C++17 (GCC 7-32) TESTS 23 281 77209600
265399305 Superposition H2 June 11, 2024, 6:38 p.m. OK C++17 (GCC 7-32) TESTS 23 311 84992000
265399477 Mtaylor H2 June 11, 2024, 6:40 p.m. OK C++17 (GCC 7-32) TESTS 23 342 169881600
265402519 __sig H2 June 11, 2024, 7:11 p.m. OK C++17 (GCC 7-32) TESTS 23 359 77209600
265427193 AkiLotus H2 June 12, 2024, 2:45 a.m. OK C++17 (GCC 7-32) TESTS 23 389 89907200
265391572 Guslix H2 June 11, 2024, 5:40 p.m. OK C++17 (GCC 7-32) TESTS 23 406 110899200
265400073 18o3 H2 June 11, 2024, 6:46 p.m. OK C++17 (GCC 7-32) TESTS 23 437 86016000
265407774 yuan-shen H2 June 11, 2024, 8:12 p.m. OK C++17 (GCC 7-32) TESTS 23 437 98611200
265417491 Khawaja_ H2 June 11, 2024, 11:19 p.m. OK C++20 (GCC 13-64) TESTS 23 139 76492800
265417003 Hosen_ba H2 June 11, 2024, 11:06 p.m. OK C++20 (GCC 13-64) TESTS 23 171 48537600
265425991 misalignedDiv H2 June 12, 2024, 2:29 a.m. OK C++20 (GCC 13-64) TESTS 23 187 119091200
265416326 Boboge H2 June 11, 2024, 10:49 p.m. OK C++20 (GCC 13-64) TESTS 23 218 98713600
265426260 hhhyh H2 June 12, 2024, 2:33 a.m. OK C++20 (GCC 13-64) TESTS 23 233 98713600
265399350 Superposition H2 June 11, 2024, 6:38 p.m. OK C++20 (GCC 13-64) TESTS 23 249 97996800
265441932 LNian H2 June 12, 2024, 5:42 a.m. OK C++20 (GCC 13-64) TESTS 23 249 98611200
265411215 OMG_wc H2 June 11, 2024, 8:58 p.m. OK C++20 (GCC 13-64) TESTS 23 249 100249600
265400580 18o3 H2 June 11, 2024, 6:51 p.m. OK C++20 (GCC 13-64) TESTS 23 250 78643200
265414735 Mohamedtarekfayez H2 June 11, 2024, 10:07 p.m. OK C++20 (GCC 13-64) TESTS 23 265 115302400
265410476 dzhi H2 June 11, 2024, 8:46 p.m. OK Java 21 TESTS 23 1327 143155200
265410217 dzhi H2 June 11, 2024, 8:41 p.m. OK Java 21 TESTS 23 1406 143155200
265399817 profchi H2 June 11, 2024, 6:44 p.m. OK Java 8 TESTS 23 1218 125849600
265412042 invincible777 H2 June 11, 2024, 9:12 p.m. OK Java 8 TESTS 23 1343 217804800
265441553 gardengnome H2 June 12, 2024, 5:38 a.m. OK PyPy 3-64 TESTS 23 1061 177152000
265399352 fatalerror H2 June 11, 2024, 6:38 p.m. OK PyPy 3-64 TESTS 23 1264 202240000
265405246 OLOGY H2 June 11, 2024, 7:42 p.m. OK PyPy 3-64 TESTS 23 1265 235212800
265408485 OLOGY H2 June 11, 2024, 8:18 p.m. OK PyPy 3-64 TESTS 23 1296 235110400
265413076 ow3nLLL H2 June 11, 2024, 9:31 p.m. OK PyPy 3-64 TESTS 23 1343 176128000
265405683 OLOGY H2 June 11, 2024, 7:48 p.m. OK PyPy 3-64 TESTS 23 1358 235110400
265406294 OLOGY H2 June 11, 2024, 7:55 p.m. OK PyPy 3-64 TESTS 23 1359 235110400
265409891 shash4321 H2 June 11, 2024, 8:37 p.m. OK PyPy 3-64 TESTS 23 1577 310272000
265418906 liupengsay H2 June 11, 2024, 11:58 p.m. OK PyPy 3-64 TESTS 23 1703 423628800
265411912 mipha2024 H2 June 11, 2024, 9:09 p.m. OK PyPy 3-64 TESTS 23 1718 323686400
265430542 toor H2 June 12, 2024, 3:30 a.m. OK Rust 2021 TESTS 23 452 306483200

remove filters

Back to search problems