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 a , consisting of 3 rows and n columns. Each cell of the matrix is either free or taken. A free cell y is reachable from a free cell x if at least one of these conditions hold: A connected component is a set of free cells of the matrix such that all cells in it are reachable from one another, but adding any other free cell to the set violates this rule. You are asked q queries about the matrix. Each query is the following: Print the answers to all queries. The first line contains an integer n ( 1 <= n <= 5 cdot 10^5 ) -- the number of columns of matrix a . The i -th of the next three lines contains a description of the i -th row of the matrix a -- a string, consisting of n characters. Each character is either 1 (denoting a free cell) or 0 (denoting a taken cell). The next line contains an integer q ( 1 <= q <= 3 cdot 10^5 ) -- the number of queries. The j -th of the next q lines contains two integers l_j and r_j ( 1 <= l_j <= r_j <= n ) -- the description of the j -th query. Print q integers -- the j -th value should be equal to the number of the connected components of the matrix, consisting of columns from l_j to r_j of the matrix a , inclusive. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
153253060 |
diamond_dick |
E |
April 10, 2022, 3 a.m. |
OK |
GNU C++14 |
TESTS |
38 |
109 |
11878400 |
|
|
153230985 |
Vectors_Master |
E |
April 9, 2022, 6:28 p.m. |
OK |
GNU C++14 |
TESTS |
38 |
420 |
36864000 |
|
|
153222710 |
Xopered |
E |
April 9, 2022, 4:54 p.m. |
OK |
GNU C++14 |
TESTS |
38 |
436 |
19865600 |
|
|
153260740 |
Jonothor_Darry |
E |
April 10, 2022, 5:30 a.m. |
OK |
GNU C++14 |
TESTS |
38 |
467 |
132198400 |
|
|
153218465 |
liumuxin |
E |
April 9, 2022, 4:33 p.m. |
OK |
GNU C++14 |
TESTS |
38 |
514 |
66662400 |
|
|
153216486 |
zhaotiensn |
E |
April 9, 2022, 4:28 p.m. |
OK |
GNU C++14 |
TESTS |
38 |
530 |
73625600 |
|
|
153223596 |
Yaimsea |
E |
April 9, 2022, 5:01 p.m. |
OK |
GNU C++14 |
TESTS |
38 |
638 |
63590400 |
|
|
153247448 |
CunFu_ZhuGe |
E |
April 10, 2022, 12:14 a.m. |
OK |
GNU C++14 |
TESTS |
38 |
670 |
82124800 |
|
|
153256732 |
Starfish19 |
E |
April 10, 2022, 4:24 a.m. |
OK |
GNU C++14 |
TESTS |
38 |
779 |
76185600 |
|
|
153219220 |
2829908231 |
E |
April 9, 2022, 4:34 p.m. |
OK |
GNU C++14 |
TESTS |
38 |
794 |
65433600 |
|
|
153231413 |
Kochekov |
E |
April 9, 2022, 6:34 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
218 |
7680000 |
|
|
153231179 |
thanhan |
E |
April 9, 2022, 6:30 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
233 |
9932800 |
|
|
153222659 |
serotonin |
E |
April 9, 2022, 4:54 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
249 |
7680000 |
|
|
153228543 |
mohamedelsadek |
E |
April 9, 2022, 5:55 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
265 |
9728000 |
|
|
153227278 |
mohamedelsadek |
E |
April 9, 2022, 5:39 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
265 |
9728000 |
|
|
153235096 |
qwerty2300730 |
E |
April 9, 2022, 7:27 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
280 |
17100800 |
|
|
153212452 |
zhaojinxi |
E |
April 9, 2022, 4:18 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
280 |
29798400 |
|
|
153216601 |
ZXyang |
E |
April 9, 2022, 4:29 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
312 |
26726400 |
|
|
153245710 |
willy108 |
E |
April 9, 2022, 11:11 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
327 |
54579200 |
|
|
153214198 |
ZigZagK |
E |
April 9, 2022, 4:22 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
342 |
120115200 |
|
|
153216230 |
Iejoepher |
E |
April 9, 2022, 4:28 p.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
217 |
27750400 |
|
|
153241666 |
KKT_89 |
E |
April 9, 2022, 9:21 p.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
217 |
36966400 |
|
|
153215256 |
ei133333 |
E |
April 9, 2022, 4:25 p.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
265 |
28876800 |
|
|
153251051 |
tyin |
E |
April 10, 2022, 2:11 a.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
311 |
22835200 |
|
|
153242015 |
tom2003 |
E |
April 9, 2022, 9:28 p.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
436 |
16588800 |
|
|
153232984 |
nigus |
E |
April 9, 2022, 6:57 p.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
452 |
7372800 |
|
|
153233201 |
nigus |
E |
April 9, 2022, 7 p.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
452 |
9318400 |
|
|
153243458 |
JaroslavUrban |
E |
April 9, 2022, 10:03 p.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
452 |
23244800 |
|
|
153220439 |
minmise |
E |
April 9, 2022, 4:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
529 |
26828800 |
|
|
153237228 |
Bungmint |
E |
April 9, 2022, 8:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
38 |
561 |
43622400 |
|
|
153217283 |
LordVoIdebug |
E |
April 9, 2022, 4:30 p.m. |
OK |
GNU C++20 (64) |
TESTS |
38 |
156 |
15564800 |
|
|
153246585 |
sum |
E |
April 9, 2022, 11:43 p.m. |
OK |
GNU C++20 (64) |
TESTS |
38 |
171 |
18022400 |
|
|
153223290 |
geospiza |
E |
April 9, 2022, 4:59 p.m. |
OK |
GNU C++20 (64) |
TESTS |
38 |
171 |
48128000 |
|
|
153223011 |
Newtech66 |
E |
April 9, 2022, 4:56 p.m. |
OK |
GNU C++20 (64) |
TESTS |
38 |
202 |
27545600 |
|
|
153211920 |
flukehn |
E |
April 9, 2022, 4:16 p.m. |
OK |
GNU C++20 (64) |
TESTS |
38 |
218 |
42188800 |
|
|
153226257 |
spy20051623 |
E |
April 9, 2022, 5:28 p.m. |
OK |
GNU C++20 (64) |
TESTS |
38 |
233 |
46182400 |
|
|
153230822 |
definitelynotmee |
E |
April 9, 2022, 6:26 p.m. |
OK |
GNU C++20 (64) |
TESTS |
38 |
248 |
35532800 |
|
|
153225566 |
overnap |
E |
April 9, 2022, 5:20 p.m. |
OK |
GNU C++20 (64) |
TESTS |
38 |
249 |
26521600 |
|
|
153236134 |
new_acc |
E |
April 9, 2022, 7:42 p.m. |
OK |
GNU C++20 (64) |
TESTS |
38 |
265 |
46489600 |
|
|
153225650 |
overnap |
E |
April 9, 2022, 5:21 p.m. |
OK |
GNU C++20 (64) |
TESTS |
38 |
280 |
26521600 |
|
|
153228121 |
arvindf232 |
E |
April 9, 2022, 5:50 p.m. |
OK |
Kotlin 1.4 |
TESTS |
38 |
857 |
31539200 |
|
|
153215983 |
EduRoundOnly |
E |
April 9, 2022, 4:27 p.m. |
OK |
Kotlin 1.4 |
TESTS |
38 |
904 |
31539200 |
|
|
153223239 |
r57shell |
E |
April 9, 2022, 4:58 p.m. |
OK |
MS C++ 2017 |
TESTS |
38 |
514 |
10240000 |
|
|
153237349 |
machine_solution |
E |
April 9, 2022, 8:03 p.m. |
OK |
MS C++ 2017 |
TESTS |
38 |
1637 |
132403200 |
|
|
remove filters
Back to search problems