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.
Problems
B'There is a grid, consisting of n rows and m columns. Each cell of the grid is either free or blocked. One of the free cells contains a lab. All the cells beyond the borders of the grid are also blocked. A crazy robot has escaped from this lab. It is currently in some free cell of the grid. You can send one of the following commands to the robot: "move right", "move down", "move left" or "move up". Each command means moving to a neighbouring cell in the corresponding direction. However, as the robot is crazy, it will do anything except following the command. Upon receiving a command, it will choose a direction such that it differs from the one in command and the cell in that direction is not blocked. If there is such a direction, then it will move to a neighbouring cell in that direction. Otherwise, it will do nothing. We want to get the robot to the lab to get it fixed. For each free cell, determine if the robot can be forced to reach the lab starting in this cell. That is, after each step of the robot a command can be sent to a robot such that no matter what different directions the robot chooses, it will end up in a lab. The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of testcases. The first line of each testcase contains two integers n and m ( 1 <= n, m <= 10^6 ; n cdot m <= 10^6 ) -- the number of rows and the number of columns in the grid. The i -th of the next n lines provides a description of the i -th row of the grid. It consists of m elements of one of three types: The grid contains exactly one lab. The sum of n cdot m over all testcases doesn 't exceed 10^6 . For each testcase find the free cells that the robot can be forced to reach the lab from. Given the grid, replace the free cells (marked with a dot) with a plus sign ( '+ ') for the cells that the robot can be forced to reach the lab from. Print the resulting grid. In the first te'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
137720561 |
eastnman |
E |
Dec. 1, 2021, 6:48 p.m. |
OK |
Delphi |
TESTS |
18 |
717 |
63590400 |
|
|
137742228 |
Mrgglock |
E |
Dec. 2, 2021, 4:12 a.m. |
OK |
GNU C11 |
TESTS |
18 |
405 |
93388800 |
|
|
137706766 |
yiwangchensha |
E |
Dec. 1, 2021, 4:41 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
109 |
2150400 |
|
|
137731934 |
AbdelrahmanKhaled |
E |
Dec. 1, 2021, 10:49 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
124 |
2048000 |
|
|
137717822 |
SSAASSUUKKEE |
E |
Dec. 1, 2021, 6:14 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
124 |
3993600 |
|
|
137717408 |
akshatverma |
E |
Dec. 1, 2021, 6:09 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
139 |
2048000 |
|
|
137748857 |
SF-Manman |
E |
Dec. 2, 2021, 6 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
139 |
30003200 |
|
|
137733444 |
Pharaonic_fox |
E |
Dec. 2, 2021, 12:13 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
140 |
18022400 |
|
|
137713039 |
zhaoyutxdy |
E |
Dec. 1, 2021, 5:25 p.m. |
OK |
GNU C++14 |
TESTS |
18 |
170 |
26112000 |
|
|
137735198 |
Etamsylate |
E |
Dec. 2, 2021, 1:13 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
171 |
26112000 |
|
|
137743471 |
DLUT_Zeratul |
E |
Dec. 2, 2021, 4:36 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
171 |
27340800 |
|
|
137746622 |
bottle__ |
E |
Dec. 2, 2021, 5:29 a.m. |
OK |
GNU C++14 |
TESTS |
18 |
171 |
27340800 |
|
|
137715121 |
CosAlpha |
E |
Dec. 1, 2021, 5:44 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
108 |
1024000 |
|
|
137705546 |
hengyiqun |
E |
Dec. 1, 2021, 4:36 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
108 |
1024000 |
|
|
137746116 |
swapnilvc |
E |
Dec. 2, 2021, 5:22 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
108 |
1024000 |
|
|
137737662 |
varlokmaker |
E |
Dec. 2, 2021, 2:26 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
108 |
2048000 |
|
|
137710990 |
pakka_papad |
E |
Dec. 1, 2021, 5:07 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
108 |
2969600 |
|
|
137715773 |
Megumin2006 |
E |
Dec. 1, 2021, 5:51 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
108 |
2969600 |
|
|
137718909 |
ILHOM_45 |
E |
Dec. 1, 2021, 6:27 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
108 |
3993600 |
|
|
137743840 |
adityagarwal2000 |
E |
Dec. 2, 2021, 4:43 a.m. |
OK |
GNU C++17 |
TESTS |
18 |
109 |
1024000 |
|
|
137703589 |
suryansh12 |
E |
Dec. 1, 2021, 4:32 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
109 |
1024000 |
|
|
137709975 |
hoangthilinhhuong1 |
E |
Dec. 1, 2021, 5 p.m. |
OK |
GNU C++17 |
TESTS |
18 |
109 |
5017600 |
|
|
137710561 |
NO-COMPETITION |
E |
Dec. 1, 2021, 5:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
93 |
2048000 |
|
|
137735992 |
xiaobaibai123 |
E |
Dec. 2, 2021, 1:36 a.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
93 |
2048000 |
|
|
137716929 |
akshatverma |
E |
Dec. 1, 2021, 6:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
93 |
2048000 |
|
|
137714567 |
AuroraLight |
E |
Dec. 1, 2021, 5:39 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
93 |
9011200 |
|
|
137717541 |
akshatverma |
E |
Dec. 1, 2021, 6:11 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
108 |
2048000 |
|
|
137748952 |
noobiesAG |
E |
Dec. 2, 2021, 6:01 a.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
108 |
16998400 |
|
|
137702162 |
harshavardhan0512 |
E |
Dec. 1, 2021, 4:29 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
124 |
15052800 |
|
|
137720346 |
noobiesAG |
E |
Dec. 1, 2021, 6:45 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
124 |
16998400 |
|
|
137726012 |
follen |
E |
Dec. 1, 2021, 8:13 p.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
139 |
34201600 |
|
|
137737199 |
Kawaii |
E |
Dec. 2, 2021, 2:13 a.m. |
OK |
GNU C++17 (64) |
TESTS |
18 |
140 |
18022400 |
|
|
137703316 |
AdC_AB2 |
E |
Dec. 1, 2021, 4:31 p.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
77 |
1024000 |
|
|
137701711 |
YeoBL |
E |
Dec. 1, 2021, 4:28 p.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
77 |
1024000 |
|
|
137718139 |
akshatverma |
E |
Dec. 1, 2021, 6:18 p.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
77 |
2048000 |
|
|
137717507 |
akshatverma |
E |
Dec. 1, 2021, 6:10 p.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
77 |
2048000 |
|
|
137710461 |
rUnTiMe_TeRRORrr |
E |
Dec. 1, 2021, 5:03 p.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
77 |
2048000 |
|
|
137703741 |
AdC_AB2 |
E |
Dec. 1, 2021, 4:32 p.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
77 |
3993600 |
|
|
137701637 |
AdC_AB2 |
E |
Dec. 1, 2021, 4:28 p.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
78 |
5632000 |
|
|
137713620 |
Amimoy12 |
E |
Dec. 1, 2021, 5:30 p.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
93 |
2969600 |
|
|
137705099 |
AdC_AB2 |
E |
Dec. 1, 2021, 4:34 p.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
93 |
3379200 |
|
|
137706887 |
AdC_AB2 |
E |
Dec. 1, 2021, 4:41 p.m. |
OK |
GNU C++20 (64) |
TESTS |
18 |
93 |
5632000 |
|
|
137733098 |
LucunJi |
E |
Dec. 2, 2021, midnight |
OK |
Java 11 |
TESTS |
18 |
217 |
0 |
|
|
137730477 |
st_coder |
E |
Dec. 1, 2021, 10:02 p.m. |
OK |
Java 11 |
TESTS |
18 |
436 |
20377600 |
|
|
137715085 |
prituladima |
E |
Dec. 1, 2021, 5:44 p.m. |
OK |
Java 11 |
TESTS |
18 |
482 |
31539200 |
|
|
137711597 |
Tykonan |
E |
Dec. 1, 2021, 5:13 p.m. |
OK |
Java 11 |
TESTS |
18 |
592 |
77209600 |
|
|
137706131 |
MubtasimShahriar |
E |
Dec. 1, 2021, 4:38 p.m. |
OK |
Java 11 |
TESTS |
18 |
639 |
33484800 |
|
|
137722977 |
SaberXpro |
E |
Dec. 1, 2021, 7:22 p.m. |
OK |
Java 11 |
TESTS |
18 |
654 |
33484800 |
|
|
137707435 |
MrOtter |
E |
Dec. 1, 2021, 4:44 p.m. |
OK |
Java 11 |
TESTS |
18 |
670 |
32972800 |
|
|
137727821 |
podtelkin |
E |
Dec. 1, 2021, 8:51 p.m. |
OK |
Java 11 |
TESTS |
18 |
763 |
40652800 |
|
|
137747010 |
sumitchavan |
E |
Dec. 2, 2021, 5:34 a.m. |
OK |
Java 11 |
TESTS |
18 |
794 |
74240000 |
|
|
137725046 |
dheerajchhatanidc |
E |
Dec. 1, 2021, 7:55 p.m. |
OK |
Java 11 |
TESTS |
18 |
858 |
65740800 |
|
|
137722528 |
mwen |
E |
Dec. 1, 2021, 7:16 p.m. |
OK |
Java 8 |
TESTS |
18 |
670 |
82124800 |
|
|
137716540 |
pribic |
E |
Dec. 1, 2021, 5:59 p.m. |
OK |
Java 8 |
TESTS |
18 |
717 |
71680000 |
|
|
137716944 |
pribic |
E |
Dec. 1, 2021, 6:04 p.m. |
OK |
Java 8 |
TESTS |
18 |
810 |
71884800 |
|
|
137727029 |
phenomenal_98 |
E |
Dec. 1, 2021, 8:35 p.m. |
OK |
Java 8 |
TESTS |
18 |
811 |
123187200 |
|
|
137726621 |
bkifhr9 |
E |
Dec. 1, 2021, 8:26 p.m. |
OK |
Java 8 |
TESTS |
18 |
888 |
111001600 |
|
|
137726643 |
Akram-Adel |
E |
Dec. 1, 2021, 8:26 p.m. |
OK |
Java 8 |
TESTS |
18 |
889 |
111001600 |
|
|
137704331 |
elizarov |
E |
Dec. 1, 2021, 4:33 p.m. |
OK |
Kotlin 1.5 |
TESTS |
18 |
733 |
72908800 |
|
|
137705193 |
elizarov |
E |
Dec. 1, 2021, 4:34 p.m. |
OK |
Kotlin 1.5 |
TESTS |
18 |
764 |
72806400 |
|
|
137733285 |
OlavBakken |
E |
Dec. 2, 2021, 12:07 a.m. |
OK |
MS C++ 2017 |
TESTS |
18 |
311 |
36147200 |
|
|
137733657 |
OlavBakken |
E |
Dec. 2, 2021, 12:20 a.m. |
OK |
MS C++ 2017 |
TESTS |
18 |
374 |
35123200 |
|
|
137745324 |
MrSemyon12 |
E |
Dec. 2, 2021, 5:09 a.m. |
OK |
MS C++ 2017 |
TESTS |
18 |
498 |
54579200 |
|
|
137715356 |
grey |
E |
Dec. 1, 2021, 5:46 p.m. |
OK |
MS C++ 2017 |
TESTS |
18 |
529 |
28057600 |
|
|
137706310 |
r57shell |
E |
Dec. 1, 2021, 4:38 p.m. |
OK |
MS C++ 2017 |
TESTS |
18 |
530 |
67686400 |
|
|
137720640 |
OLOGY |
E |
Dec. 1, 2021, 6:49 p.m. |
OK |
PyPy 2 |
TESTS |
18 |
1029 |
114892800 |
|
|
137720938 |
OLOGY |
E |
Dec. 1, 2021, 6:53 p.m. |
OK |
PyPy 2 |
TESTS |
18 |
1029 |
115609600 |
|
|
137720404 |
OLOGY |
E |
Dec. 1, 2021, 6:46 p.m. |
OK |
PyPy 2 |
TESTS |
18 |
1045 |
115097600 |
|
|
137732858 |
sudoSieg |
E |
Dec. 1, 2021, 11:27 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
1029 |
83968000 |
|
|
137705592 |
keroru |
E |
Dec. 1, 2021, 4:36 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
1169 |
35225600 |
|
|
137730637 |
whatshisbucket |
E |
Dec. 1, 2021, 10:08 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
1403 |
110489600 |
|
|
137722638 |
Liberator187 |
E |
Dec. 1, 2021, 7:17 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
1543 |
95846400 |
|
|
137705002 |
Liberator187 |
E |
Dec. 1, 2021, 4:34 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
1543 |
95846400 |
|
|
137711872 |
hxu10 |
E |
Dec. 1, 2021, 5:15 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
1699 |
158720000 |
|
|
137706106 |
toam |
E |
Dec. 1, 2021, 4:38 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
1778 |
95232000 |
|
|
137709781 |
xuanji |
E |
Dec. 1, 2021, 4:58 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
1809 |
172339200 |
|
|
137713245 |
r57shell |
E |
Dec. 1, 2021, 5:27 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
1949 |
207155200 |
|
|
137703556 |
mkawa2 |
E |
Dec. 1, 2021, 4:32 p.m. |
OK |
PyPy 3 |
TESTS |
18 |
1950 |
171827200 |
|
|
137733024 |
armsusman |
E |
Dec. 1, 2021, 11:34 p.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
1247 |
167833600 |
|
|
137701930 |
PiKa_PiKaa_chuuu |
E |
Dec. 1, 2021, 4:28 p.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
1590 |
284672000 |
|
|
137708782 |
Aksnov |
E |
Dec. 1, 2021, 4:52 p.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
1762 |
249958400 |
|
|
137735417 |
hxu10 |
E |
Dec. 2, 2021, 1:19 a.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
1793 |
265932800 |
|
|
137722610 |
Liberator187 |
E |
Dec. 1, 2021, 7:17 p.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
1840 |
170291200 |
|
|
137746992 |
swapnilvc |
E |
Dec. 2, 2021, 5:34 a.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
1887 |
247603200 |
|
|
137708843 |
huikang |
E |
Dec. 1, 2021, 4:52 p.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
1887 |
275046400 |
|
|
137715680 |
KA_Rma |
E |
Dec. 1, 2021, 5:50 p.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
1903 |
258457600 |
|
|
137715730 |
KA_Rma |
E |
Dec. 1, 2021, 5:51 p.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
1965 |
258252800 |
|
|
137744930 |
swapnilvc |
E |
Dec. 2, 2021, 5:02 a.m. |
OK |
PyPy 3-64 |
TESTS |
18 |
1980 |
249548800 |
|
|
137731028 |
noogler |
E |
Dec. 1, 2021, 10:19 p.m. |
OK |
Rust |
TESTS |
18 |
420 |
80281600 |
|
|
137730199 |
noogler |
E |
Dec. 1, 2021, 9:53 p.m. |
OK |
Rust |
TESTS |
18 |
436 |
120422400 |
|
|
137721188 |
sansen |
E |
Dec. 1, 2021, 6:56 p.m. |
OK |
Rust 2021 |
TESTS |
18 |
280 |
101785600 |
|
|
137735408 |
Avanta |
E |
Dec. 2, 2021, 1:19 a.m. |
OK |
Rust 2021 |
TESTS |
18 |
530 |
82432000 |
|
|
137735369 |
Avanta |
E |
Dec. 2, 2021, 1:18 a.m. |
OK |
Rust 2021 |
TESTS |
18 |
545 |
82432000 |
|
|
137735467 |
Avanta |
E |
Dec. 2, 2021, 1:20 a.m. |
OK |
Rust 2021 |
TESTS |
18 |
545 |
106598400 |
|
|
137735442 |
Avanta |
E |
Dec. 2, 2021, 1:20 a.m. |
OK |
Rust 2021 |
TESTS |
18 |
608 |
82432000 |
|
|
remove filters
Back to search problems