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 |
---|---|---|---|---|---|---|
1689 | Codeforces Round 798 (Div. 2) | FINISHED | False | 7200 | 82387463 | June 10, 2022, 4:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 4289 ) | D | Lena and Matrix | PROGRAMMING | brute force data structures dp shortest paths |
B"Lena is a beautiful girl who likes logical puzzles. As a gift for her birthday, Lena got a matrix puzzle! The matrix consists of n rows and m columns, and each cell is either black or white. The coordinates (i,j) denote the cell which belongs to the i -th row and j -th column for every 1 <= q i <= q n and 1 <= q j <= q m . To solve the puzzle, Lena has to choose a cell that minimizes the Manhattan distance to the farthest black cell from the chosen cell. More formally, let there be k ge 1 black cells in the matrix with coordinates (x_i,y_i) for every 1 <= q i <= q k . Lena should choose a cell (a,b) that minimizes max_{i=1}^{k}(|a-x_i|+|b-y_i|). As Lena has no skill, she asked you for help. Will you tell her the optimal cell to choose? There are several test cases in the input data. The first line contains a single integer t ( 1 <= q t <= q 10 ,000 ) -- the number of test cases. This is followed by the test cases description. The first line of each test case contains two integers n and m ( 2 <= q n,m <= q 1000 ) -- the dimensions of the matrix. The following n lines contain m characters each, each character is either 'W' or 'B'. The j -th character in the i -th of these lines is 'W' if the cell (i,j) is white, and 'B' if the cell (i,j) is black. It is guaranteed that at least one black cell exists. It is guaranteed that the sum of n cdot m does not exceed 10^6 . For each test case, output the optimal cell (a,b) to choose. If multiple answers exist, output any. In the first test case the two black cells have coordinates (1,1) and (3,2) . The four optimal cells are (1,2) , (2,1) , (2,2) and (3,1) . It can be shown that no other cell minimizes the maximum Manhattan distance to every black cell. In the second test case it is optimal to choose the black cell (2,2) with ma"... |
Editorial for Codeforces Round #798 (Div. 2) |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
160130716 | chro4896 | D | June 10, 2022, 6:20 p.m. | OK | GNU C11 | TESTS | 31 | 171 | 17100800 | ||
160147360 | SuperJ6 | D | June 10, 2022, 9:19 p.m. | OK | GNU C++14 | TESTS | 31 | 46 | 0 | ||
160154290 | quanlt206 | D | June 11, 2022, 2:07 a.m. | OK | GNU C++14 | TESTS | 31 | 46 | 0 | ||
160152163 | shivam_751 | D | June 11, 2022, 12:44 a.m. | OK | GNU C++14 | TESTS | 31 | 46 | 0 | ||
160134885 | Nobody2310 | D | June 10, 2022, 6:32 p.m. | OK | GNU C++14 | TESTS | 31 | 46 | 204800 | ||
160150688 | Mryange | D | June 10, 2022, 11:23 p.m. | OK | GNU C++14 | TESTS | 31 | 46 | 1024000 | ||
160144986 | ratneshk | D | June 10, 2022, 8:27 p.m. | OK | GNU C++14 | TESTS | 31 | 46 | 1945600 | ||
160162335 | Fluffy_boy | D | June 11, 2022, 5:07 a.m. | OK | GNU C++14 | TESTS | 31 | 46 | 12697600 | ||
160139425 | Acfboy | D | June 10, 2022, 7:12 p.m. | OK | GNU C++14 | TESTS | 31 | 46 | 64307200 | ||
160126660 | Valters07 | D | June 10, 2022, 6:06 p.m. | OK | GNU C++14 | TESTS | 31 | 61 | 1024000 | ||
160149026 | Natlis | D | June 10, 2022, 10:11 p.m. | OK | GNU C++14 | TESTS | 31 | 61 | 1331200 | ||
160156760 | rascalrabbit | D | June 11, 2022, 3:14 a.m. | OK | GNU C++17 | TESTS | 31 | 46 | 0 | ||
160141555 | enermynoname | D | June 10, 2022, 7:34 p.m. | OK | GNU C++17 | TESTS | 31 | 46 | 0 | ||
160140230 | karrigan0108 | D | June 10, 2022, 7:20 p.m. | OK | GNU C++17 | TESTS | 31 | 46 | 0 | ||
160133867 | Tansho | D | June 10, 2022, 6:29 p.m. | OK | GNU C++17 | TESTS | 31 | 46 | 0 | ||
160146292 | 1ev6in4 | D | June 10, 2022, 8:54 p.m. | OK | GNU C++17 | TESTS | 31 | 46 | 0 | ||
160140652 | jonatas57 | D | June 10, 2022, 7:24 p.m. | OK | GNU C++17 | TESTS | 31 | 46 | 204800 | ||
160160355 | Hazzu | D | June 11, 2022, 4:33 a.m. | OK | GNU C++17 | TESTS | 31 | 46 | 1024000 | ||
160159069 | khoanhkhacaytoidayeu | D | June 11, 2022, 4:08 a.m. | OK | GNU C++17 | TESTS | 31 | 46 | 1024000 | ||
160151225 | Rahkin. | D | June 10, 2022, 11:54 p.m. | OK | GNU C++17 | TESTS | 31 | 46 | 1024000 | ||
160143964 | vkgainz | D | June 10, 2022, 8:08 p.m. | OK | GNU C++17 | TESTS | 31 | 46 | 1024000 | ||
160136897 | Bobocan | D | June 10, 2022, 6:58 p.m. | OK | GNU C++17 (64) | TESTS | 31 | 31 | 0 | ||
160158818 | jiajieshi | D | June 11, 2022, 4:03 a.m. | OK | GNU C++17 (64) | TESTS | 31 | 31 | 2867200 | ||
160144029 | kucipendik | D | June 10, 2022, 8:09 p.m. | OK | GNU C++17 (64) | TESTS | 31 | 46 | 0 | ||
160138966 | GaLz | D | June 10, 2022, 7:09 p.m. | OK | GNU C++17 (64) | TESTS | 31 | 46 | 0 | ||
160144474 | Richw818 | D | June 10, 2022, 8:17 p.m. | OK | GNU C++17 (64) | TESTS | 31 | 46 | 0 | ||
160140525 | Dio707 | D | June 10, 2022, 7:23 p.m. | OK | GNU C++17 (64) | TESTS | 31 | 46 | 0 | ||
160146229 | introvert_hu_bhai | D | June 10, 2022, 8:53 p.m. | OK | GNU C++17 (64) | TESTS | 31 | 46 | 102400 | ||
160152267 | mbdbr | D | June 11, 2022, 12:48 a.m. | OK | GNU C++17 (64) | TESTS | 31 | 46 | 102400 | ||
160140973 | OnMyZenith | D | June 10, 2022, 7:28 p.m. | OK | GNU C++17 (64) | TESTS | 31 | 46 | 102400 | ||
160166022 | ingingin | D | June 11, 2022, 6:01 a.m. | OK | GNU C++17 (64) | TESTS | 31 | 46 | 1024000 | ||
160143467 | nekstas | D | June 10, 2022, 8 p.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 0 | ||
160165225 | coderdhanraj | D | June 11, 2022, 5:50 a.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 0 | ||
160157337 | xeqeq | D | June 11, 2022, 3:29 a.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 0 | ||
160153406 | johnLate | D | June 11, 2022, 1:35 a.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 0 | ||
160146613 | 1ev6in4 | D | June 10, 2022, 9:01 p.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 0 | ||
160146574 | 1ev6in4 | D | June 10, 2022, 9 p.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 0 | ||
160146047 | codificador10 | D | June 10, 2022, 8:48 p.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 0 | ||
160145526 | kovaxis | D | June 10, 2022, 8:37 p.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 0 | ||
160144283 | Nea1 | D | June 10, 2022, 8:14 p.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 0 | ||
160143239 | Nea1 | D | June 10, 2022, 7:56 p.m. | OK | GNU C++20 (64) | TESTS | 31 | 31 | 0 | ||
160150180 | dunkingdonuts | D | June 10, 2022, 10:59 p.m. | OK | Java 11 | TESTS | 31 | 264 | 0 | ||
160151730 | dunkingdonuts | D | June 11, 2022, 12:21 a.m. | OK | Java 11 | TESTS | 31 | 265 | 0 | ||
160148104 | profchi | D | June 10, 2022, 9:42 p.m. | OK | Java 11 | TESTS | 31 | 373 | 0 | ||
160141084 | freehandle | D | June 10, 2022, 7:29 p.m. | OK | Java 11 | TESTS | 31 | 389 | 17612800 | ||
160146240 | JigarNainuji | D | June 10, 2022, 8:53 p.m. | OK | Java 11 | TESTS | 31 | 467 | 60313600 | ||
160138451 | idorashau | D | June 10, 2022, 7:05 p.m. | OK | Java 11 | TESTS | 31 | 576 | 0 | ||
160147236 | dzhi | D | June 10, 2022, 9:15 p.m. | OK | Java 11 | TESTS | 31 | 1856 | 153702400 | ||
160146977 | dzhi | D | June 10, 2022, 9:09 p.m. | OK | Java 11 | TESTS | 31 | 1918 | 153804800 | ||
160134261 | Sharon | D | June 10, 2022, 6:31 p.m. | OK | Java 8 | TESTS | 31 | 265 | 9216000 | ||
160155961 | RetARDed1111 | D | June 11, 2022, 2:54 a.m. | OK | Java 8 | TESTS | 31 | 296 | 0 | ||
160150413 | invincible777 | D | June 10, 2022, 11:08 p.m. | OK | Java 8 | TESTS | 31 | 327 | 35635200 | ||
160134987 | ashanksingh1997 | D | June 10, 2022, 6:32 p.m. | OK | Java 8 | TESTS | 31 | 842 | 19660800 | ||
160140723 | Golovanov399 | D | June 10, 2022, 7:25 p.m. | OK | Kotlin 1.6 | TESTS | 31 | 390 | 1536000 | ||
160150325 | SlavaG | D | June 10, 2022, 11:05 p.m. | OK | Kotlin 1.6 | TESTS | 31 | 436 | 29081600 | ||
160126019 | ktropin | D | June 10, 2022, 6:04 p.m. | OK | Mono C# | TESTS | 31 | 202 | 14745600 | ||
160140606 | BalaluevEgor | D | June 10, 2022, 7:23 p.m. | OK | MS C++ 2017 | TESTS | 31 | 218 | 9420800 | ||
160137735 | BusIgor | D | June 10, 2022, 7:01 p.m. | OK | MS C++ 2017 | TESTS | 31 | 218 | 24371200 | ||
160140254 | savinovalex | D | June 10, 2022, 7:20 p.m. | OK | MS C++ 2017 | TESTS | 31 | 249 | 34816000 | ||
160152353 | ankan2526 | D | June 11, 2022, 12:52 a.m. | OK | PyPy 3 | TESTS | 31 | 405 | 10752000 | ||
160135653 | pedrosorio | D | June 10, 2022, 6:34 p.m. | OK | PyPy 3 | TESTS | 31 | 514 | 10649600 | ||
160138650 | hxu10 | D | June 10, 2022, 7:06 p.m. | OK | PyPy 3 | TESTS | 31 | 529 | 23347200 | ||
160143081 | voicon | D | June 10, 2022, 7:54 p.m. | OK | PyPy 3 | TESTS | 31 | 530 | 10547200 | ||
160161920 | ambs_ | D | June 11, 2022, 5:01 a.m. | OK | PyPy 3 | TESTS | 31 | 623 | 10854400 | ||
160135207 | eepsilon | D | June 10, 2022, 6:33 p.m. | OK | PyPy 3 | TESTS | 31 | 639 | 10649600 | ||
160126315 | skhan_org | D | June 10, 2022, 6:05 p.m. | OK | PyPy 3 | TESTS | 31 | 1091 | 35123200 | ||
160128264 | tcltk | D | June 10, 2022, 6:12 p.m. | OK | PyPy 3 | TESTS | 31 | 1107 | 86016000 | ||
160135136 | Amiy_Tiwari | D | June 10, 2022, 6:33 p.m. | OK | PyPy 3 | TESTS | 31 | 1372 | 48742400 | ||
160139068 | Adroit_001 | D | June 10, 2022, 7:09 p.m. | OK | PyPy 3-64 | TESTS | 31 | 343 | 49766400 | ||
160138998 | wicked_knight | D | June 10, 2022, 7:09 p.m. | OK | PyPy 3-64 | TESTS | 31 | 358 | 39014400 | ||
160126103 | siganai | D | June 10, 2022, 6:04 p.m. | OK | PyPy 3-64 | TESTS | 31 | 389 | 38707200 | ||
160148495 | _MADARA_ | D | June 10, 2022, 9:53 p.m. | OK | PyPy 3-64 | TESTS | 31 | 483 | 35532800 | ||
160154745 | pirate0 | D | June 11, 2022, 2:21 a.m. | OK | PyPy 3-64 | TESTS | 31 | 685 | 12492800 | ||
160148156 | Martin53 | D | June 10, 2022, 9:43 p.m. | OK | PyPy 3-64 | TESTS | 31 | 1013 | 46592000 | ||
160134252 | Croco | D | June 10, 2022, 6:31 p.m. | OK | PyPy 3-64 | TESTS | 31 | 1419 | 56217600 | ||
160146554 | farrellbyu | D | June 10, 2022, 9 p.m. | OK | PyPy 3-64 | TESTS | 31 | 1668 | 172544000 | ||
160134280 | AndrescuIII | D | June 10, 2022, 6:31 p.m. | OK | Python 3 | TESTS | 31 | 1793 | 1536000 |
Back to search problems