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"You are given a matrix of size n xe2 x80 x89 xc3 x97 xe2 x80 x89m. Each element of the matrix is either 1 or 0. You have to determine the number of connected components consisting of 1's. Two cells belong to the same component if they have a common border, and both elements in these cells are 1's. Note that the memory limit is unusual! The first line contains two numbers n and m (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89212, 4 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89214) -- the number of rows and columns, respectively. It is guaranteed that m is divisible by 4. Then the representation of matrix follows. Each of n next lines contains one-digit hexadecimal numbers (that is, these numbers can be represented either as digits from 0 to 9 or as uppercase Latin letters from A to F). Binary representation of each of these numbers denotes next 4 elements of the matrix in the corresponding row. For example, if the number B is given, then the corresponding elements are 1011, and if the number is 5, then the corresponding elements are 0101. Elements are not separated by whitespaces. Print the number of connected components consisting of 1's. In the first example the matrix is: It is clear that it has three components. The second example: It is clear that the number of components is 2. There are no 1's in the third example, so the answer is 0. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
32087182 |
Faimerth |
E |
Nov. 6, 2017, 4:13 a.m. |
OK |
GNU C |
TESTS |
53 |
1419 |
7577600 |
|
2500 |
32299129 |
Tconan |
E |
Nov. 14, 2017, 12:50 a.m. |
OK |
GNU C++ |
TESTS |
53 |
1154 |
614400 |
|
2500 |
32302615 |
Tconan |
E |
Nov. 14, 2017, 3:11 a.m. |
OK |
GNU C++ |
TESTS |
53 |
1200 |
307200 |
|
2500 |
31911393 |
bestFy |
E |
Oct. 31, 2017, 5:47 a.m. |
OK |
GNU C++ |
TESTS |
53 |
1278 |
307200 |
|
2500 |
31901409 |
wzp666 |
E |
Oct. 30, 2017, 5:36 p.m. |
OK |
GNU C++ |
TESTS |
53 |
1294 |
614400 |
|
2500 |
31984236 |
huangzhen |
E |
Nov. 2, 2017, 3:09 p.m. |
OK |
GNU C++ |
TESTS |
53 |
1403 |
204800 |
|
2500 |
32284762 |
Tconan |
E |
Nov. 13, 2017, 1:04 p.m. |
OK |
GNU C++ |
TESTS |
53 |
1404 |
307200 |
|
2500 |
32155806 |
qyf123 |
E |
Nov. 9, 2017, 11:06 a.m. |
OK |
GNU C++ |
TESTS |
53 |
1543 |
512000 |
|
2500 |
31997600 |
vjudge5 |
E |
Nov. 3, 2017, 5:02 a.m. |
OK |
GNU C++ |
TESTS |
53 |
1559 |
409600 |
|
2500 |
31997624 |
Caproner |
E |
Nov. 3, 2017, 5:06 a.m. |
OK |
GNU C++ |
TESTS |
53 |
1575 |
409600 |
|
2500 |
31919927 |
Scut82 |
E |
Oct. 31, 2017, 11:53 a.m. |
OK |
GNU C++ |
TESTS |
53 |
1591 |
716800 |
|
2500 |
68280993 |
rainboy |
E |
Jan. 5, 2020, 5:08 p.m. |
OK |
GNU C11 |
TESTS |
53 |
1762 |
409600 |
|
2500 |
60010965 |
vjudge1 |
E |
Sept. 4, 2019, 11:07 a.m. |
OK |
GNU C++11 |
TESTS |
53 |
810 |
409600 |
|
2500 |
58525431 |
TianJianXing |
E |
Aug. 10, 2019, 6:53 a.m. |
OK |
GNU C++11 |
TESTS |
53 |
1060 |
307200 |
|
2500 |
52068735 |
xielinhan |
E |
March 31, 2019, 6:50 a.m. |
OK |
GNU C++11 |
TESTS |
53 |
1060 |
307200 |
|
2500 |
58575365 |
TianPingXing |
E |
Aug. 11, 2019, 12:07 p.m. |
OK |
GNU C++11 |
TESTS |
53 |
1060 |
307200 |
|
2500 |
39701122 |
yukuai26 |
E |
June 27, 2018, 12:19 p.m. |
OK |
GNU C++11 |
TESTS |
53 |
1169 |
204800 |
|
2500 |
65892999 |
luogu_bot1 |
E |
Nov. 28, 2019, 4:32 a.m. |
OK |
GNU C++11 |
TESTS |
53 |
1169 |
307200 |
|
2500 |
68022012 |
wlzs |
E |
Jan. 1, 2020, 12:37 a.m. |
OK |
GNU C++11 |
TESTS |
53 |
1185 |
307200 |
|
2500 |
31821541 |
Durant_Lee |
E |
Oct. 28, 2017, 12:25 a.m. |
OK |
GNU C++11 |
TESTS |
53 |
1185 |
614400 |
|
2500 |
31813452 |
tfg |
E |
Oct. 27, 2017, 5:04 p.m. |
OK |
GNU C++11 |
TESTS |
53 |
1200 |
819200 |
|
2500 |
58669864 |
TianJianXing |
E |
Aug. 12, 2019, 2 p.m. |
OK |
GNU C++11 |
TESTS |
53 |
1263 |
512000 |
|
2500 |
55129582 |
rdfzXR |
E |
June 5, 2019, 2:34 p.m. |
OK |
GNU C++14 |
TESTS |
53 |
842 |
409600 |
|
2500 |
55123812 |
rdfzXR |
E |
June 5, 2019, 11:56 a.m. |
OK |
GNU C++14 |
TESTS |
53 |
951 |
512000 |
|
2500 |
31813579 |
ugly2333 |
E |
Oct. 27, 2017, 5:08 p.m. |
OK |
GNU C++14 |
TESTS |
53 |
982 |
409600 |
|
2500 |
34208813 |
shoemakerjo |
E |
Jan. 15, 2018, 10:24 p.m. |
OK |
GNU C++14 |
TESTS |
53 |
982 |
2457600 |
|
2500 |
55123230 |
rdfzXR |
E |
June 5, 2019, 11:41 a.m. |
OK |
GNU C++14 |
TESTS |
53 |
997 |
512000 |
|
2500 |
40979277 |
ReaLNero1 |
E |
July 30, 2018, 5 p.m. |
OK |
GNU C++14 |
TESTS |
53 |
998 |
307200 |
|
2500 |
31900675 |
OmarSaber |
E |
Oct. 30, 2017, 5:07 p.m. |
OK |
GNU C++14 |
TESTS |
53 |
1029 |
204800 |
|
2500 |
31909553 |
Namnamseo |
E |
Oct. 31, 2017, 3:10 a.m. |
OK |
GNU C++14 |
TESTS |
53 |
1029 |
409600 |
|
2500 |
40586654 |
sebi110 |
E |
July 20, 2018, 6:09 p.m. |
OK |
GNU C++14 |
TESTS |
53 |
1029 |
6348800 |
|
2500 |
31900642 |
OmarSaber |
E |
Oct. 30, 2017, 5:06 p.m. |
OK |
GNU C++14 |
TESTS |
53 |
1060 |
204800 |
|
2500 |
58544238 |
TianSunXing |
E |
Aug. 10, 2019, 3:44 p.m. |
OK |
GNU C++17 |
TESTS |
53 |
1216 |
307200 |
|
2500 |
58542087 |
TianZuiXing |
E |
Aug. 10, 2019, 2:43 p.m. |
OK |
GNU C++17 |
TESTS |
53 |
1232 |
307200 |
|
2500 |
58541832 |
TianZuiXing |
E |
Aug. 10, 2019, 2:36 p.m. |
OK |
GNU C++17 |
TESTS |
53 |
1248 |
307200 |
|
2500 |
58541298 |
xgsteins |
E |
Aug. 10, 2019, 2:19 p.m. |
OK |
GNU C++17 |
TESTS |
53 |
1294 |
409600 |
|
2500 |
58689635 |
TianJianXing |
E |
Aug. 13, 2019, 2:25 a.m. |
OK |
GNU C++17 |
TESTS |
53 |
1326 |
512000 |
|
2500 |
58689634 |
TianPingXing |
E |
Aug. 13, 2019, 2:25 a.m. |
OK |
GNU C++17 |
TESTS |
53 |
1326 |
512000 |
|
2500 |
39406113 |
Ali_Pi |
E |
June 19, 2018, 9:56 a.m. |
OK |
GNU C++17 |
TESTS |
53 |
1340 |
307200 |
|
2500 |
58546277 |
xgsteins |
E |
Aug. 10, 2019, 4:51 p.m. |
OK |
GNU C++17 |
TESTS |
53 |
1543 |
921600 |
|
2500 |
58679798 |
TianSunXing |
E |
Aug. 12, 2019, 6:20 p.m. |
OK |
GNU C++17 |
TESTS |
53 |
1575 |
307200 |
|
2500 |
58667098 |
918243576 |
E |
Aug. 12, 2019, 12:59 p.m. |
OK |
GNU C++17 |
TESTS |
53 |
1622 |
1331200 |
|
2500 |
68281358 |
Dukkha |
E |
Jan. 5, 2020, 5:12 p.m. |
OK |
Java 11 |
TESTS |
53 |
2542 |
0 |
|
2500 |
31807795 |
kessido |
E |
Oct. 27, 2017, 3:21 p.m. |
OK |
Java 8 |
TESTS |
53 |
1840 |
3686400 |
|
2500 |
32338399 |
wolfor |
E |
Nov. 15, 2017, 5:15 p.m. |
OK |
Java 8 |
TESTS |
53 |
1996 |
3481600 |
|
2500 |
31966964 |
unused |
E |
Nov. 2, 2017, 3:12 a.m. |
OK |
Java 8 |
TESTS |
53 |
2276 |
4300800 |
|
2500 |
32055540 |
olya-chuchuk |
E |
Nov. 4, 2017, 2:09 p.m. |
OK |
Java 8 |
TESTS |
53 |
2339 |
3481600 |
|
2500 |
31847257 |
_tb |
E |
Oct. 28, 2017, 6:07 p.m. |
OK |
Java 8 |
TESTS |
53 |
2589 |
3686400 |
|
2500 |
31847351 |
_tb |
E |
Oct. 28, 2017, 6:11 p.m. |
OK |
Java 8 |
TESTS |
53 |
2605 |
3686400 |
|
2500 |
31847174 |
_tb |
E |
Oct. 28, 2017, 6:04 p.m. |
OK |
Java 8 |
TESTS |
53 |
2651 |
3686400 |
|
2500 |
62238500 |
_tb |
E |
Oct. 10, 2019, 12:14 a.m. |
OK |
Java 8 |
TESTS |
53 |
2651 |
3891200 |
|
2500 |
62237688 |
_tb |
E |
Oct. 9, 2019, 11:47 p.m. |
OK |
Java 8 |
TESTS |
53 |
2651 |
3891200 |
|
2500 |
41133357 |
Taran_1407 |
E |
Aug. 2, 2018, 6:53 p.m. |
OK |
Java 8 |
TESTS |
53 |
2823 |
3788800 |
|
2500 |
31855968 |
ldt116 |
E |
Oct. 29, 2017, 4:55 a.m. |
OK |
Kotlin |
TESTS |
53 |
2464 |
4608000 |
|
2500 |
31966885 |
unused |
E |
Nov. 2, 2017, 3:05 a.m. |
OK |
Mono C# |
TESTS |
53 |
2604 |
1331200 |
|
2500 |
31966865 |
unused |
E |
Nov. 2, 2017, 3:03 a.m. |
OK |
MS C# |
TESTS |
53 |
2558 |
1228800 |
|
2500 |
58541517 |
TianZuiXing |
E |
Aug. 10, 2019, 2:25 p.m. |
OK |
MS C++ |
TESTS |
53 |
1044 |
307200 |
|
2500 |
58668107 |
TianJianXing |
E |
Aug. 12, 2019, 1:20 p.m. |
OK |
MS C++ |
TESTS |
53 |
1606 |
1024000 |
|
2500 |
31841947 |
AleksanderBalobanov |
E |
Oct. 28, 2017, 2:57 p.m. |
OK |
MS C++ |
TESTS |
53 |
1731 |
3891200 |
|
2500 |
31882237 |
sozib_hossain |
E |
Oct. 30, 2017, 6:06 a.m. |
OK |
MS C++ |
TESTS |
53 |
1746 |
4300800 |
|
2500 |
31967017 |
unused |
E |
Nov. 2, 2017, 3:17 a.m. |
OK |
MS C++ |
TESTS |
53 |
1762 |
819200 |
|
2500 |
39672222 |
Fortin |
E |
June 26, 2018, 10:05 a.m. |
OK |
MS C++ |
TESTS |
53 |
2433 |
614400 |
|
2500 |
39948917 |
WooDeND |
E |
July 4, 2018, 9:02 a.m. |
OK |
MS C++ |
TESTS |
53 |
2730 |
2867200 |
|
2500 |
remove filters
Back to search problems