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'The black king lives on a chess board with an infinite number of columns (files) and 8 rows (ranks). The columns are numbered with all integer numbers (including negative). The rows are numbered from 1 to 8 . Initially, the black king is located on the starting square (x_s, y_s) , and he needs to reach some target square (x_t, y_t) . Unfortunately, there are also white pieces on the board, and they threaten the black king. After negotiations, the white pieces agreed to let the black king pass to the target square on the following conditions: Help the black king find the minimum number of moves needed to reach the target square while not violating the conditions. The black king cannot leave the board at any time. The black king moves according to the movement rules below. Even though the white pieces never move, squares which they can reach in one move are considered to be under attack, so the black king cannot move into those squares. Below are the movement rules. Note that the pieces (except for the knight) cannot jump over other pieces. There are no pawns on the board. The first line contains two integers x_s and y_s ( 1 <= x_s <= 10^8 ; 1 <= y_s <= 8 ) -- the starting coordinates of the black king. The second line contains two integers x_t and y_t ( 1 <= x_t <= 10^8 ; 1 <= y_t <= 8 ) -- the coordinates of the target square for the black king. The third line contains one integer n ( 0 <= n <= 2000 ) -- the number of white pieces on the board. Then n lines follow, the i -th line contains one character t_i and two integers x_i and y_i ( 1 <= x_i <= 10^8 ; 1 <= y_i <= 8 ) -- the type and the coordinates of the i -th white piece. The types of pieces are represented by the following uppercase Latin letters: There can be any number of white pieces of any type listed above on the board, for example, 3 white kings or '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
182920335 |
Heibor CodigoL reedef |
I |
Nov. 27, 2022, 2:57 p.m. |
OK |
GNU C++14 |
TESTS |
105 |
31 |
2048000 |
|
2800 |
182914600 |
Gary2005 platelet LZDQ |
I |
Nov. 27, 2022, 2:08 p.m. |
OK |
GNU C++14 |
TESTS |
105 |
62 |
118476800 |
|
2800 |
182958745 |
Alpha_Q |
I |
Nov. 28, 2022, 12:43 a.m. |
OK |
GNU C++17 |
TESTS |
105 |
93 |
14233600 |
|
2800 |
182928646 |
xuanquang1999 |
I |
Nov. 27, 2022, 4:13 p.m. |
OK |
GNU C++17 |
TESTS |
105 |
171 |
16588800 |
|
2800 |
182924499 |
gisp_zjz triple__a Roundgod |
I |
Nov. 27, 2022, 3:34 p.m. |
OK |
GNU C++17 |
TESTS |
105 |
187 |
28467200 |
|
2800 |
182919505 |
Zappeko errorgorn rama_pang |
I |
Nov. 27, 2022, 2:49 p.m. |
OK |
GNU C++17 |
TESTS |
105 |
202 |
20480000 |
|
2800 |
182917788 |
BabaVoss |
I |
Nov. 27, 2022, 2:34 p.m. |
OK |
GNU C++17 |
TESTS |
105 |
234 |
28364800 |
|
2800 |
182908992 |
Merkurev Um_nik |
I |
Nov. 27, 2022, 1:25 p.m. |
OK |
GNU C++17 |
TESTS |
105 |
264 |
96768000 |
|
2800 |
182915846 |
surgutti kamilszymczak1 Rafi22 |
I |
Nov. 27, 2022, 2:19 p.m. |
OK |
GNU C++17 |
TESTS |
105 |
1169 |
31436800 |
|
2800 |
182782146 |
SSRS_ |
I |
Nov. 27, 2022, 11:44 a.m. |
OK |
GNU C++17 (64) |
TESTS |
105 |
62 |
5017600 |
|
2800 |
182929676 |
kotatsugame |
I |
Nov. 27, 2022, 4:23 p.m. |
OK |
GNU C++17 (64) |
TESTS |
105 |
202 |
56627200 |
|
2800 |
182917275 |
Mr_Eight He_Ren Qingyu |
I |
Nov. 27, 2022, 2:30 p.m. |
OK |
GNU C++20 (64) |
TESTS |
105 |
46 |
7680000 |
|
2800 |
182918745 |
wust_HKX sunyuheng365 whxxhn |
I |
Nov. 27, 2022, 2:43 p.m. |
OK |
GNU C++20 (64) |
TESTS |
105 |
46 |
10649600 |
|
2800 |
182899707 |
AdaptiveControl AlternatingCurrent njwrz |
I |
Nov. 27, 2022, 12:16 p.m. |
OK |
GNU C++20 (64) |
TESTS |
105 |
78 |
37990400 |
|
2800 |
182907868 |
changruinian2020 feecIe6418 gyh20 |
I |
Nov. 27, 2022, 1:16 p.m. |
OK |
GNU C++20 (64) |
TESTS |
105 |
93 |
44032000 |
|
2800 |
182922096 |
KbltQaQ sjc061031 |
I |
Nov. 27, 2022, 3:13 p.m. |
OK |
GNU C++20 (64) |
TESTS |
105 |
93 |
44544000 |
|
2800 |
182912169 |
353cerega Batrr |
I |
Nov. 27, 2022, 1:49 p.m. |
OK |
GNU C++20 (64) |
TESTS |
105 |
327 |
71065600 |
|
2800 |
182948791 |
Adam_GS |
I |
Nov. 27, 2022, 8:34 p.m. |
OK |
GNU C++20 (64) |
TESTS |
105 |
998 |
63897600 |
|
2800 |
182912283 |
Maripium jefrai nvmdava |
I |
Nov. 27, 2022, 1:50 p.m. |
OK |
GNU C++20 (64) |
TESTS |
105 |
1044 |
46182400 |
|
2800 |
182913054 |
LeoPro fastmath turmax |
I |
Nov. 27, 2022, 1:56 p.m. |
OK |
GNU C++20 (64) |
TESTS |
105 |
1106 |
130252800 |
|
2800 |
182948748 |
Adam_GS |
I |
Nov. 27, 2022, 8:33 p.m. |
OK |
GNU C++20 (64) |
TESTS |
105 |
2729 |
77516800 |
|
2800 |
182921902 |
huangxw |
I |
Nov. 27, 2022, 3:11 p.m. |
OK |
PyPy 3-64 |
TESTS |
105 |
2074 |
235827200 |
|
2800 |
remove filters
Back to search problems