Codeforces Round 941 (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
1965 Codeforces Round 941 (Div. 1) FINISHED False 7200 22951463 April 27, 2024, 2:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 317 ) E Connected Cubes PROGRAMMING constructive algorithms games 3100

B'There are n cdot m unit cubes currently in positions (1, 1, 1) through (n, m, 1) . Each of these cubes is one of k colors. You want to add additional cubes at any integer coordinates such that the subset of cubes of each color is connected, where two cubes are considered connected if they share a face. In other words, for every pair of cubes of the same color c , it should be possible to travel from one to the other, moving only through cubes of color c that share a face. The existing cubes are currently in the corner of a room. There are colorless cubes completely filling the planes x = 0 , y = 0 , and z = 0 , preventing you from placing additional cubes there or at any negative coordinates. Find a solution that uses at most 4 cdot 10^5 additional cubes (not including the cubes that are currently present), or determine that there is no solution. It can be shown that under the given constraints, if there is a solution, there is one using at most 4 cdot 10^5 additional cubes. The first line of the input contains three integers n , m , and k ( 2 <= n, m, k <= 50 ) -- the number of rows and columns of cubes, and the number of colors, respectively. The i -th of the next n lines contains m integers. The j -th of these is a_{ij} ( 1 <= a_{ij} <= k ) -- the color of the cube at position (i, j, 1) . For every color from 1 to k , it is guaranteed that there is at least one cube in the input of that color. If there is no solution, print a single integer -1 . Otherwise, the first line of output should contain a single integer p ( 0 <= p <= 4 cdot 10^5 ) -- the number of additional cubes you will add. The next p lines should contain four integers x , y , z and c ( 1 <= x, y, z <= 10^6 , 1 <= c <= k ) -- indicating that you are adding a cube with color c at positi'...

Tutorials

Codeforces Round #941 (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
260993860 luogu_bot1 E May 15, 2024, 2:22 a.m. OK C++14 (GCC 6-32) TESTS 78 125 9011200 3100
258505445 jason_sun E April 28, 2024, 2:36 a.m. OK C++14 (GCC 6-32) TESTS 78 140 10342400 3100
259070956 by_chance E May 2, 2024, 1:59 a.m. OK C++14 (GCC 6-32) TESTS 78 155 4710400 3100
258631163 MMYYFF E April 29, 2024, 2:40 a.m. OK C++14 (GCC 6-32) TESTS 78 171 9318400 3100
258560992 Kazemaru E April 28, 2024, 12:23 p.m. OK C++14 (GCC 6-32) TESTS 78 171 33075200 3100
258522739 hxhhxh E April 28, 2024, 6:35 a.m. OK C++14 (GCC 6-32) TESTS 78 171 64204800 3100
262131256 hxhhxh E May 22, 2024, 10:52 a.m. OK C++14 (GCC 6-32) TESTS 78 186 64204800 3100
259840419 by_chance E May 7, 2024, 7:32 a.m. OK C++14 (GCC 6-32) TESTS 78 187 4710400 3100
258455031 _l_l_ E April 27, 2024, 3:58 p.m. OK C++14 (GCC 6-32) TESTS 74 187 9011200 3100
263130696 lxeason E May 29, 2024, 11:10 a.m. OK C++14 (GCC 6-32) TESTS 78 187 16076800 3100
258806730 xiaoziyao E April 30, 2024, 3:16 a.m. OK C++17 (GCC 7-32) TESTS 78 140 9011200 3100
260261233 XY_Eleven E May 10, 2024, 2:19 p.m. OK C++17 (GCC 7-32) TESTS 78 155 9011200 3100
258515976 _l_l_ E April 28, 2024, 4:59 a.m. OK C++17 (GCC 7-32) TESTS 78 155 9011200 3100
261617230 YeahPotato E May 19, 2024, 7:37 a.m. OK C++17 (GCC 7-32) TESTS 78 156 6451200 3100
258486140 xiaoziya E April 27, 2024, 7:52 p.m. OK C++17 (GCC 7-32) TESTS 76 156 9011200 3100
260106377 zmy123456 E May 9, 2024, 10:42 a.m. OK C++17 (GCC 7-32) TESTS 78 171 2457600 3100
258819974 SoiMae E April 30, 2024, 6:27 a.m. OK C++17 (GCC 7-32) TESTS 78 171 5427200 3100
260197657 luanmenglei E May 10, 2024, 3:26 a.m. OK C++17 (GCC 7-32) TESTS 78 171 9011200 3100
258631229 MMYYFF E April 29, 2024, 2:42 a.m. OK C++17 (GCC 7-32) TESTS 78 171 9011200 3100
258464749 Flamire E April 27, 2024, 4:26 p.m. OK C++17 (GCC 7-32) TESTS 74 171 9113600 3100
258499667 N_z__ E April 27, 2024, 11:55 p.m. OK C++20 (GCC 13-64) TESTS 78 92 10137600 3100
258528974 QedDust413 E April 28, 2024, 7:34 a.m. OK C++20 (GCC 13-64) TESTS 78 108 3788800 3100
258799650 cmk666 E April 30, 2024, 12:45 a.m. OK C++20 (GCC 13-64) TESTS 78 108 10547200 3100
258527748 QedDust413 E April 28, 2024, 7:22 a.m. OK C++20 (GCC 13-64) TESTS 78 109 3788800 3100
258451385 Sulfox E April 27, 2024, 3:47 p.m. OK C++20 (GCC 13-64) TESTS 74 124 13209600 3100
258629982 Ari E April 29, 2024, 2:12 a.m. OK C++20 (GCC 13-64) TESTS 78 125 10035200 3100
258806331 rui_er E April 30, 2024, 3:08 a.m. OK C++20 (GCC 13-64) TESTS 78 139 10137600 3100
258989433 JWRuixi E May 1, 2024, 9:24 a.m. OK C++20 (GCC 13-64) TESTS 78 140 10035200 3100
259280547 Ormlis E May 2, 2024, 11:40 p.m. OK C++20 (GCC 13-64) TESTS 78 140 10035200 3100
258599702 lucasxia01 E April 28, 2024, 5:31 p.m. OK C++20 (GCC 13-64) TESTS 78 140 10035200 3100
258461425 Gassa E April 27, 2024, 4:17 p.m. OK D TESTS 74 671 35737600 3100
258475132 rainboy E April 27, 2024, 6:05 p.m. OK GNU C11 TESTS 74 1671 6553600 3100
258467729 knightL E April 27, 2024, 4:32 p.m. OK Java 8 TESTS 74 296 11468800 3100
258477667 SecondThread E April 27, 2024, 6:24 p.m. OK Java 8 TESTS 74 343 78028800 3100
258477508 SecondThread E April 27, 2024, 6:23 p.m. OK Java 8 TESTS 74 343 78028800 3100
258453762 bruhopen E April 27, 2024, 3:54 p.m. OK Kotlin 1.9 TESTS 74 374 13312000 3100
258439974 conqueror_of_tourist E April 27, 2024, 3:18 p.m. OK PyPy 3-64 TESTS 74 358 43315200 3100
258543969 Little_Sheep_Yawn E April 28, 2024, 9:45 a.m. OK PyPy 3-64 TESTS 78 437 43929600 3100
258620310 el_tunel E April 28, 2024, 9:45 p.m. OK PyPy 3-64 TESTS 78 452 10752000 3100
258467131 SeptaCube E April 27, 2024, 4:31 p.m. OK PyPy 3-64 TESTS 74 609 96153600 3100
258516476 Ibrohim0704 E April 28, 2024, 5:07 a.m. OK PyPy 3-64 TESTS 78 780 89804800 3100
258467077 shade34 E April 27, 2024, 4:31 p.m. OK Python 3 TESTS 74 1280 40243200 3100
259097024 lalitha_72 E May 2, 2024, 7:55 a.m. OK Python 3 TESTS 78 2031 43622400 3100
259097101 lalitha_72 E May 2, 2024, 7:56 a.m. OK Python 3 TESTS 78 2046 43622400 3100

remove filters

Back to search problems