Codeforces Round 542 [Alex Lopashev Thanks-Round] (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
1130 Codeforces Round 542 [Alex Lopashev Thanks-Round] (Div. 2) FINISHED False 7200 186416687 Feb. 24, 2019, 3:35 p.m.

Problems

Solved$
Index
Name
Type
Tags
Community Tag
Rating
( 8742 ) C Connect PROGRAMMING brute force dfs and similar ds 1400

B"Alice lives on a flat planet that can be modeled as a square grid of size n x n , with rows and columns enumerated from 1 to n . We represent the cell at the intersection of row r and column c with ordered pair (r, c) . Each cell in the grid is either land or water. Alice resides in land cell (r_1, c_1) . She wishes to travel to land cell (r_2, c_2) . At any moment, she may move to one of the cells adjacent to where she is --in one of the four directions (i.e., up, down, left, or right). Unfortunately, Alice cannot swim, and there is no viable transportation means other than by foot (i.e., she can walk only on land). As a result, Alice's trip may be impossible. To help Alice, you plan to create at most one tunnel between some two land cells. The tunnel will allow Alice to freely travel between the two endpoints. Indeed, creating a tunnel is a lot of effort: the cost of creating a tunnel between cells (r_s, c_s) and (r_t, c_t) is (r_s-r_t)^2 + (c_s-c_t)^2 . For now, your task is to find the minimum possible cost of creating at most one tunnel so that Alice could travel from (r_1, c_1) to (r_2, c_2) . If no tunnel needs to be created, the cost is 0 . The first line contains one integer n ( 1 <= q n <= q 50 ) -- the width of the square grid. The second line contains two space-separated integers r_1 and c_1 ( 1 <= q r_1, c_1 <= q n ) -- denoting the cell where Alice resides. The third line contains two space-separated integers r_2 and c_2 ( 1 <= q r_2, c_2 <= q n ) -- denoting the cell to which Alice wishes to travel. Each of the following n lines contains a string of n characters. The j -th character of the i -th such line ( 1 <= q i, j <= q n ) is 0 if (i, j) is land or 1 if (i, j) is water. It is guaranteed that (r_1, c_1) and (r_2, c_2) are land. Print an integer that is the minimum "...

Tutorials

65520

Submissions

Submission Id
Author(s)
Index
Submitted
Verdict
Language
Test Set
Tests Passed
Time taken (ms)
Memory Consumed (bytes)
Tags
Rating
50465096 octocoder C Feb. 24, 2019, 7:25 p.m. OK Clang++17 Diagnostics TESTS 38 93 1126400 1400
50444213 ruban C Feb. 24, 2019, 4:06 p.m. OK Delphi TESTS 38 171 12083200 1400
51356179 AlifSaddid C March 16, 2019, 4:26 a.m. OK FPC TESTS 38 30 3993600 1400
56739741 luogu_bot2 C July 9, 2019, 7:08 a.m. OK FPC TESTS 38 31 102400 1400
56739880 luogu_bot3 C July 9, 2019, 7:11 a.m. OK FPC TESTS 38 31 102400 1400
56739464 jiang5ye C July 9, 2019, 7:01 a.m. OK FPC TESTS 38 31 102400 1400
50455513 PAG C Feb. 24, 2019, 5:04 p.m. OK FPC TESTS 38 31 102400 1400
50440933 PhuongPeu C Feb. 24, 2019, 3:54 p.m. OK FPC TESTS 38 31 204800 1400
50440704 Oompaloompa C Feb. 24, 2019, 3:54 p.m. OK FPC TESTS 38 31 512000 1400
56740217 luogu_bot1 C July 9, 2019, 7:20 a.m. OK FPC TESTS 38 31 921600 1400
51467249 chaorenhaha C March 19, 2019, 2:58 a.m. OK FPC TESTS 38 31 1024000 1400
51473315 chaorenhaha C March 19, 2019, 7:56 a.m. OK FPC TESTS 38 31 5120000 1400
50453552 Horcrux1729 C Feb. 24, 2019, 4:53 p.m. OK GNU C11 TESTS 38 30 307200 1400
50508629 rainboy C Feb. 25, 2019, 9:34 p.m. OK GNU C11 TESTS 38 31 0 1400
63050073 kaiboy C Oct. 21, 2019, 1:31 a.m. OK GNU C11 TESTS 38 31 0 1400
64705729 kaiboy C Nov. 11, 2019, 4:26 p.m. OK GNU C11 TESTS 38 31 0 1400
50451543 ruhan.habib39 C Feb. 24, 2019, 4:41 p.m. OK GNU C11 TESTS 38 31 204800 1400
50446328 Kakalinn C Feb. 24, 2019, 4:14 p.m. OK GNU C11 TESTS 38 31 204800 1400
50447069 MYNAMEISSHARIFUL C Feb. 24, 2019, 4:18 p.m. OK GNU C11 TESTS 38 31 204800 1400
50457994 WhiteRose45 C Feb. 24, 2019, 5:20 p.m. OK GNU C11 TESTS 38 31 307200 1400
54546029 Sparrow C May 24, 2019, 6:14 a.m. OK GNU C11 TESTS 38 31 8089600 1400
54545985 vjudge3 C May 24, 2019, 6:13 a.m. OK GNU C11 TESTS 38 31 8089600 1400
50555105 Bug_Maker C Feb. 27, 2019, 7:28 a.m. OK GNU C++11 TESTS 38 15 204800 1400
67663565 pawanjenu C Dec. 26, 2019, 4:52 p.m. OK GNU C++11 TESTS 38 15 204800 1400
50629927 aiyeqi C March 1, 2019, 8:31 a.m. OK GNU C++11 TESTS 38 30 0 1400
51061508 vjudge4 C March 9, 2019, 3:16 a.m. OK GNU C++11 TESTS 38 30 0 1400
51747789 vjudge4 C March 23, 2019, 8:19 a.m. OK GNU C++11 TESTS 38 30 0 1400
57353893 xgcjay C July 20, 2019, 5:19 a.m. OK GNU C++11 TESTS 38 30 0 1400
50781559 vjudge1 C March 4, 2019, 11:36 a.m. OK GNU C++11 TESTS 38 30 0 1400
50445802 jxf378440404 C Feb. 24, 2019, 4:12 p.m. OK GNU C++11 TESTS 38 30 0 1400
52566272 ahcl7 C April 10, 2019, 12:32 p.m. OK GNU C++11 TESTS 38 30 102400 1400
52459114 ChenYibai C April 7, 2019, 12:43 p.m. OK GNU C++11 TESTS 38 30 102400 1400
50493186 windhs C Feb. 25, 2019, 2:06 p.m. OK GNU C++14 TESTS 38 15 0 1400
50498581 wzw19991105 C Feb. 25, 2019, 4:12 p.m. OK GNU C++14 TESTS 38 15 102400 1400
53597738 JungleGh0st C May 1, 2019, 5:45 a.m. OK GNU C++14 TESTS 38 15 102400 1400
50980080 Harpreet_nitj C March 7, 2019, 5:41 p.m. OK GNU C++14 TESTS 38 15 102400 1400
50644130 I_Love_Thao_Hien_137 C March 1, 2019, 3:08 p.m. OK GNU C++14 TESTS 38 15 102400 1400
50508319 arman.... C Feb. 25, 2019, 9:19 p.m. OK GNU C++14 TESTS 38 15 102400 1400
68946932 Jigar_Z C Jan. 16, 2020, 4:31 p.m. OK GNU C++14 TESTS 38 15 204800 1400
62187425 xenowits C Oct. 9, 2019, 8:41 a.m. OK GNU C++14 TESTS 38 15 204800 1400
51472442 BinaryCrazy C March 19, 2019, 7:25 a.m. OK GNU C++14 TESTS 38 15 204800 1400
56674596 keta_tsimakuridze C July 7, 2019, 2:49 p.m. OK GNU C++14 TESTS 38 15 204800 1400
50586685 le9018468 C Feb. 28, 2019, 4:25 a.m. OK GNU C++17 TESTS 38 15 0 1400
50594743 vjudge2 C Feb. 28, 2019, 9:30 a.m. OK GNU C++17 TESTS 38 15 0 1400
50466624 vstrimaitis C Feb. 24, 2019, 8:13 p.m. OK GNU C++17 TESTS 38 15 102400 1400
50446580 PerpEternal C Feb. 24, 2019, 4:15 p.m. OK GNU C++17 TESTS 38 15 102400 1400
50513712 aakk C Feb. 26, 2019, 4:22 a.m. OK GNU C++17 TESTS 38 15 102400 1400
50523380 2018329621197 C Feb. 26, 2019, 10:36 a.m. OK GNU C++17 TESTS 38 15 102400 1400
50560365 CheaSim C Feb. 27, 2019, 10:38 a.m. OK GNU C++17 TESTS 38 15 102400 1400
51059949 vjudge3 C March 9, 2019, 2:17 a.m. OK GNU C++17 TESTS 38 15 102400 1400
66439229 Shariful___Islam C Dec. 7, 2019, 7:22 a.m. OK GNU C++17 TESTS 38 15 204800 1400
66592852 qazsdf C Dec. 10, 2019, 1:34 p.m. OK GNU C++17 TESTS 38 15 204800 1400
50741250 HedgehogUES C March 3, 2019, 3:37 p.m. OK Go TESTS 38 31 5324800 1400
50452733 caidodo0_0 C Feb. 24, 2019, 4:48 p.m. OK Go TESTS 38 46 0 1400
50912927 sonowz C March 7, 2019, 4:04 a.m. OK Haskell TESTS 38 124 102400 1400
65318891 Zoravar C Nov. 18, 2019, 6:44 p.m. OK Java 8 TESTS 38 109 0 1400
64522403 MahmoudJobeel C Nov. 8, 2019, 12:44 p.m. OK Java 8 TESTS 38 109 0 1400
57113648 Dejokz C July 15, 2019, 6:43 p.m. OK Java 8 TESTS 38 109 0 1400
54262175 anilsaxena C May 17, 2019, 2:55 a.m. OK Java 8 TESTS 38 109 0 1400
53896347 jebaited C May 9, 2019, 6:15 a.m. OK Java 8 TESTS 38 109 0 1400
51866195 mdazmat9 C March 26, 2019, 3:16 p.m. OK Java 8 TESTS 38 109 0 1400
51277009 toshif C March 13, 2019, 10:35 p.m. OK Java 8 TESTS 38 109 0 1400
50542137 dot_slash_noob C Feb. 26, 2019, 6:45 p.m. OK Java 8 TESTS 38 109 0 1400
50526811 s_pandey6 C Feb. 26, 2019, 12:09 p.m. OK Java 8 TESTS 38 109 0 1400
50524108 msparwani C Feb. 26, 2019, 10:57 a.m. OK Java 8 TESTS 38 109 0 1400
62611769 Spheniscine C Oct. 15, 2019, 10:03 a.m. OK Kotlin TESTS 38 124 0 1400
50874744 Killer45 C March 6, 2019, 5:25 a.m. OK Kotlin TESTS 38 155 716800 1400
60186762 rego97 C Sept. 6, 2019, 6:55 p.m. OK Kotlin TESTS 38 249 512000 1400
50443208 spookywooky C Feb. 24, 2019, 4:02 p.m. OK Kotlin TESTS 38 327 1433600 1400
50449412 Coder_D C Feb. 24, 2019, 4:29 p.m. OK Mono C# TESTS 38 46 0 1400
50446932 eki C Feb. 24, 2019, 4:17 p.m. OK Mono C# TESTS 38 46 102400 1400
50448898 nigahouse1 C Feb. 24, 2019, 4:27 p.m. OK Mono C# TESTS 38 61 102400 1400
50444161 claw88 C Feb. 24, 2019, 4:06 p.m. OK Mono C# TESTS 38 62 102400 1400
51056017 semera C March 8, 2019, 10:33 p.m. OK Mono C# TESTS 38 62 204800 1400
50465093 _SHREDDER_ C Feb. 24, 2019, 7:25 p.m. OK Mono C# TESTS 38 62 3788800 1400
50455420 muslim C Feb. 24, 2019, 5:04 p.m. OK Mono C# TESTS 38 62 4608000 1400
50455952 mircea85 C Feb. 24, 2019, 5:07 p.m. OK Mono C# TESTS 38 62 5632000 1400
56005595 og.kostya C June 24, 2019, 3:21 p.m. OK Mono C# TESTS 38 77 1638400 1400
50445198 omikad C Feb. 24, 2019, 4:10 p.m. OK Mono C# TESTS 38 77 3686400 1400
57581304 vjudge2 C July 23, 2019, 8:57 a.m. OK MS C++ TESTS 38 31 0 1400
57316509 vjudge2 C July 19, 2019, 8:24 a.m. OK MS C++ TESTS 38 31 0 1400
51157780 vjudge1 C March 11, 2019, 11:08 a.m. OK MS C++ TESTS 38 31 0 1400
51135634 vjudge1 C March 10, 2019, 3:59 p.m. OK MS C++ TESTS 38 31 0 1400
51069035 vjudge5 C March 9, 2019, 7:02 a.m. OK MS C++ TESTS 38 31 0 1400
50995977 vjudge3 C March 8, 2019, 3:43 a.m. OK MS C++ TESTS 38 31 0 1400
68747356 vjudge5 C Jan. 14, 2020, 5:17 a.m. OK MS C++ TESTS 38 31 0 1400
68751423 vjudge5 C Jan. 14, 2020, 6:48 a.m. OK MS C++ TESTS 38 31 0 1400
68755043 vjudge2 C Jan. 14, 2020, 7:59 a.m. OK MS C++ TESTS 38 31 0 1400
68841288 vjudge4 C Jan. 15, 2020, 5:53 a.m. OK MS C++ TESTS 38 31 0 1400
50458910 youx C Feb. 24, 2019, 5:25 p.m. OK MS C++ 2017 TESTS 38 31 0 1400
50552123 NotNow C Feb. 27, 2019, 5:24 a.m. OK MS C++ 2017 TESTS 38 31 0 1400
52998368 2bcn C April 19, 2019, 5:39 a.m. OK MS C++ 2017 TESTS 38 31 0 1400
68884052 sphkemlane C Jan. 15, 2020, 8:11 p.m. OK MS C++ 2017 TESTS 38 31 102400 1400
68884429 sphkemlane C Jan. 15, 2020, 8:23 p.m. OK MS C++ 2017 TESTS 38 31 102400 1400
68884122 sphkemlane C Jan. 15, 2020, 8:13 p.m. OK MS C++ 2017 TESTS 38 31 102400 1400
68884530 vjudge2 C Jan. 15, 2020, 8:26 p.m. OK MS C++ 2017 TESTS 38 31 102400 1400
68884496 sphkemlane C Jan. 15, 2020, 8:25 p.m. OK MS C++ 2017 TESTS 38 31 102400 1400
68876868 sphkemlane C Jan. 15, 2020, 5:13 p.m. OK MS C++ 2017 TESTS 38 31 102400 1400
68877413 sphkemlane C Jan. 15, 2020, 5:26 p.m. OK MS C++ 2017 TESTS 38 31 102400 1400
50553035 Stanislav666 C Feb. 27, 2019, 6:10 a.m. OK PascalABC.NET TESTS 38 202 0 1400
50443337 l-_-l C Feb. 24, 2019, 4:02 p.m. OK PascalABC.NET TESTS 38 202 0 1400
51580370 fanos C March 20, 2019, 2:17 p.m. OK PascalABC.NET TESTS 38 296 614400 1400
50457212 stanislav1 C Feb. 24, 2019, 5:15 p.m. OK PascalABC.NET TESTS 38 326 512000 1400
50534890 mayakin C Feb. 26, 2019, 3:14 p.m. OK PHP TESTS 38 46 409600 1400
50445726 codeseeker C Feb. 24, 2019, 4:12 p.m. OK PyPy 2 TESTS 38 140 7782400 1400
50444941 zacker-22 C Feb. 24, 2019, 4:08 p.m. OK PyPy 2 TESTS 38 155 1843200 1400
50492516 YESMAths C Feb. 25, 2019, 1:52 p.m. OK PyPy 2 TESTS 38 155 2355200 1400
51283691 gaidash C March 14, 2019, 5:58 a.m. OK PyPy 2 TESTS 38 155 3686400 1400
53377522 vjudge1 C April 26, 2019, 8:20 p.m. OK PyPy 2 TESTS 38 155 15052800 1400
50501660 ilkerkosaroglu C Feb. 25, 2019, 5:31 p.m. OK PyPy 2 TESTS 38 156 13824000 1400
50456462 Mukundan314 C Feb. 24, 2019, 5:10 p.m. OK PyPy 2 TESTS 38 171 3584000 1400
51344911 vjudge2 C March 15, 2019, 5:57 p.m. OK PyPy 2 TESTS 38 171 15052800 1400
50501106 ilkerkosaroglu C Feb. 25, 2019, 5:17 p.m. OK PyPy 2 TESTS 38 171 26828800 1400
50501707 ilkerkosaroglu C Feb. 25, 2019, 5:32 p.m. OK PyPy 2 TESTS 38 186 26828800 1400
50755541 rafalk342 C March 3, 2019, 5:17 p.m. OK PyPy 3 TESTS 38 140 1024000 1400
54856576 Zuizehongquaunha C May 30, 2019, 7:57 p.m. OK PyPy 3 TESTS 38 155 819200 1400
56396984 FlyingBag65 C July 1, 2019, 3:03 p.m. OK PyPy 3 TESTS 38 155 2048000 1400
62342138 Tejkiran C Oct. 11, 2019, 5:43 a.m. OK PyPy 3 TESTS 38 155 2355200 1400
56638664 pfft C July 6, 2019, 10:20 p.m. OK PyPy 3 TESTS 38 155 9011200 1400
50444025 nexus.chebykin C Feb. 24, 2019, 4:05 p.m. OK PyPy 3 TESTS 38 156 1638400 1400
52875640 Spelvin C April 16, 2019, 7:26 p.m. OK PyPy 3 TESTS 38 156 1740800 1400
56961603 brosucks C July 13, 2019, 6:49 a.m. OK PyPy 3 TESTS 38 156 2150400 1400
50450406 H4Wk3ye C Feb. 24, 2019, 4:34 p.m. OK PyPy 3 TESTS 38 156 8704000 1400
50450539 Tarik02 C Feb. 24, 2019, 4:35 p.m. OK PyPy 3 TESTS 38 171 1331200 1400
50454533 firas5673 C Feb. 24, 2019, 4:58 p.m. OK Python 2 TESTS 38 171 102400 1400
51284821 gaidash C March 14, 2019, 6:37 a.m. OK Python 2 TESTS 38 171 1740800 1400
50462148 324857679 C Feb. 24, 2019, 6:33 p.m. OK Python 2 TESTS 38 186 204800 1400
51541288 vjudge4 C March 19, 2019, 6:24 p.m. OK Python 2 TESTS 38 187 2150400 1400
51541256 jooj C March 19, 2019, 6:24 p.m. OK Python 2 TESTS 38 187 2150400 1400
63208491 azala C Oct. 23, 2019, 1:59 a.m. OK Python 2 TESTS 38 202 102400 1400
63099645 vjudge2 C Oct. 21, 2019, 11:02 p.m. OK Python 2 TESTS 38 202 409600 1400
50448196 324857679 C Feb. 24, 2019, 4:23 p.m. OK Python 2 TESTS 38 202 819200 1400
61783149 muhitsarwar C Oct. 3, 2019, 1:46 p.m. OK Python 2 TESTS 38 202 1126400 1400
63099620 mateusqc C Oct. 21, 2019, 11:01 p.m. OK Python 2 TESTS 38 249 409600 1400
50769515 petushny C March 4, 2019, 3:03 a.m. OK Python 3 TESTS 38 93 1126400 1400
51080972 the_white_devil C March 9, 2019, 11:16 a.m. OK Python 3 TESTS 38 109 307200 1400
50576590 trungams C Feb. 27, 2019, 6:25 p.m. OK Python 3 TESTS 38 109 307200 1400
50469033 beemax C Feb. 24, 2019, 10:07 p.m. OK Python 3 TESTS 38 109 307200 1400
50446414 asvasil C Feb. 24, 2019, 4:15 p.m. OK Python 3 TESTS 38 109 307200 1400
50490555 Leendertz C Feb. 25, 2019, 1:10 p.m. OK Python 3 TESTS 38 109 409600 1400
50619473 Maaddy C Feb. 28, 2019, 10:47 p.m. OK Python 3 TESTS 38 109 512000 1400
51587013 yellowflash C March 20, 2019, 4:51 p.m. OK Python 3 TESTS 38 109 1536000 1400
50814498 KanhuKeNanu C March 5, 2019, 10:50 a.m. OK Python 3 TESTS 38 109 1945600 1400
50482613 messy_saurabh C Feb. 25, 2019, 9:51 a.m. OK Python 3 TESTS 38 109 2560000 1400
50453248 arzk C Feb. 24, 2019, 4:51 p.m. OK Rust TESTS 38 31 102400 1400
50456236 trishume C Feb. 24, 2019, 5:09 p.m. OK Rust TESTS 38 46 102400 1400
51416141 yakamoto C March 17, 2019, 2:06 p.m. OK Scala TESTS 38 483 0 1400
50455397 nafeezabrar C Feb. 24, 2019, 5:04 p.m. OK Scala TESTS 38 592 614400 1400

remove filters

Back to search problems