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"In his spare time Vladik estimates beauty of the flags. Every flag could be represented as the matrix n xe2 x80 x89 xc3 x97 xe2 x80 x89m which consists of positive integers. Let's define the beauty of the flag as number of components in its matrix. We call component a set of cells with same numbers and between any pair of cells from that set there exists a path through adjacent cells from same component. Here is the example of the partitioning some flag matrix into components: But this time he decided to change something in the process. Now he wants to estimate not the entire flag, but some segment. Segment of flag can be described as a submatrix of the flag matrix with opposite corners at (1, xe2 x80 x89l) and (n, xe2 x80 x89r), where conditions 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89l xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89r xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m are satisfied. Help Vladik to calculate the beauty for some segments of the given flag. First line contains three space-separated integers n, m, q (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x8910, 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m, xe2 x80 x89q xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89105) -- dimensions of flag matrix and number of segments respectively. Each of next n lines contains m space-separated integers -- description of flag matrix. All elements of flag matrix is positive integers not exceeding 106. Each of next q lines contains two space-separated integers l, r (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89l xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89r xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m) -- borders of segment which beauty Vladik wants to know. For each segment print the result on the corresponding line. Partitioning on components for every segment from first test case: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
37007561 |
rainboy |
E |
April 5, 2018, 8:55 p.m. |
OK |
GNU C |
TESTS |
120 |
1029 |
95334400 |
|
2600 |
30775726 |
songtoy |
E |
Sept. 27, 2017, 11:52 a.m. |
OK |
GNU C++ |
TESTS |
120 |
343 |
86528000 |
|
2600 |
27465590 |
Kvar_ispw17 |
E |
May 31, 2017, 11:43 a.m. |
OK |
GNU C++ |
TESTS |
120 |
343 |
152268800 |
|
2600 |
31145122 |
Icyfox |
E |
Oct. 8, 2017, 1:17 p.m. |
OK |
GNU C++ |
TESTS |
120 |
358 |
45670400 |
|
2600 |
27469424 |
h10_is_our_green_sun |
E |
May 31, 2017, 2:53 p.m. |
OK |
GNU C++ |
TESTS |
120 |
358 |
49049600 |
|
2600 |
41111023 |
Scut82 |
E |
Aug. 2, 2018, 6:48 a.m. |
OK |
GNU C++ |
TESTS |
120 |
358 |
49664000 |
|
2600 |
31947853 |
DoveChild |
E |
Nov. 1, 2017, 11:34 a.m. |
OK |
GNU C++ |
TESTS |
120 |
358 |
148275200 |
|
2600 |
40600681 |
luogu_bot1 |
E |
July 21, 2018, 8:24 a.m. |
OK |
GNU C++ |
TESTS |
120 |
389 |
38912000 |
|
2600 |
40600957 |
luogu_bot4 |
E |
July 21, 2018, 8:34 a.m. |
OK |
GNU C++ |
TESTS |
120 |
405 |
38912000 |
|
2600 |
27400071 |
jiyutian |
E |
May 28, 2017, 3:33 a.m. |
OK |
GNU C++ |
TESTS |
120 |
405 |
44339200 |
|
2600 |
30739118 |
zqh_wz |
E |
Sept. 26, 2017, 3:12 a.m. |
OK |
GNU C++ |
TESTS |
120 |
405 |
52940800 |
|
2600 |
54267324 |
time_interspace |
E |
May 17, 2019, 6:47 a.m. |
OK |
GNU C++11 |
TESTS |
120 |
217 |
59699200 |
|
2600 |
65511387 |
POWERRR |
E |
Nov. 22, 2019, 4:06 a.m. |
OK |
GNU C++11 |
TESTS |
120 |
280 |
45670400 |
|
2600 |
45310240 |
luogu_bot4 |
E |
Nov. 5, 2018, 3:12 a.m. |
OK |
GNU C++11 |
TESTS |
120 |
280 |
49664000 |
|
2600 |
64682552 |
Llf0703 |
E |
Nov. 11, 2019, 10:38 a.m. |
OK |
GNU C++11 |
TESTS |
120 |
312 |
61747200 |
|
2600 |
55112097 |
mrclr |
E |
June 5, 2019, 6:50 a.m. |
OK |
GNU C++11 |
TESTS |
120 |
327 |
208486400 |
|
2600 |
40980839 |
ReaLNero1 |
E |
July 30, 2018, 5:43 p.m. |
OK |
GNU C++11 |
TESTS |
120 |
342 |
41369600 |
|
2600 |
28729311 |
RockyB |
E |
July 20, 2017, 4:12 p.m. |
OK |
GNU C++11 |
TESTS |
120 |
342 |
43417600 |
|
2600 |
55112292 |
mrclr |
E |
June 5, 2019, 6:55 a.m. |
OK |
GNU C++11 |
TESTS |
120 |
342 |
52121600 |
|
2600 |
27415292 |
kefaa |
E |
May 28, 2017, 2:55 p.m. |
OK |
GNU C++11 |
TESTS |
120 |
343 |
49356800 |
|
2600 |
28729292 |
RockyB |
E |
July 20, 2017, 4:10 p.m. |
OK |
GNU C++11 |
TESTS |
120 |
358 |
43417600 |
|
2600 |
43445316 |
ChesterKing |
E |
Sept. 26, 2018, 11:07 a.m. |
OK |
GNU C++14 |
TESTS |
120 |
373 |
45772800 |
|
2600 |
27381778 |
SmallBoy |
E |
May 27, 2017, 10:42 a.m. |
OK |
GNU C++14 |
TESTS |
120 |
421 |
60313600 |
|
2600 |
27786031 |
Miloris |
E |
June 15, 2017, 4:35 a.m. |
OK |
GNU C++14 |
TESTS |
120 |
467 |
168755200 |
|
2600 |
35825408 |
xuzhiwen |
E |
March 2, 2018, 5:04 a.m. |
OK |
GNU C++14 |
TESTS |
120 |
483 |
50790400 |
|
2600 |
35825301 |
xuzhiwen |
E |
March 2, 2018, 4:58 a.m. |
OK |
GNU C++14 |
TESTS |
120 |
483 |
50790400 |
|
2600 |
27435809 |
Kerim.K |
E |
May 29, 2017, 8:28 p.m. |
OK |
GNU C++14 |
TESTS |
120 |
498 |
51302400 |
|
2600 |
27436850 |
zcg.cs60 |
E |
May 29, 2017, 10:24 p.m. |
OK |
GNU C++14 |
TESTS |
120 |
498 |
175718400 |
|
2600 |
41581305 |
I_love_Y_UME |
E |
Aug. 14, 2018, 8:13 a.m. |
OK |
GNU C++14 |
TESTS |
120 |
499 |
52531200 |
|
2600 |
27582060 |
Heilce |
E |
June 5, 2017, 11:48 a.m. |
OK |
GNU C++14 |
TESTS |
120 |
529 |
145510400 |
|
2600 |
27459830 |
Woodie |
E |
May 31, 2017, 5:48 a.m. |
OK |
GNU C++14 |
TESTS |
120 |
530 |
86630400 |
|
2600 |
56701643 |
Elegia |
E |
July 8, 2019, 9:21 a.m. |
OK |
GNU C++17 |
TESTS |
120 |
93 |
51916800 |
|
2600 |
44769936 |
iletavcioski |
E |
Oct. 24, 2018, 11:52 a.m. |
OK |
GNU C++17 |
TESTS |
120 |
483 |
37888000 |
|
2600 |
44769791 |
iletavcioski |
E |
Oct. 24, 2018, 11:48 a.m. |
OK |
GNU C++17 |
TESTS |
120 |
514 |
37888000 |
|
2600 |
44767831 |
iletavcioski |
E |
Oct. 24, 2018, 10:56 a.m. |
OK |
GNU C++17 |
TESTS |
120 |
546 |
37888000 |
|
2600 |
60761103 |
Mahir83 |
E |
Sept. 18, 2019, 10:16 a.m. |
OK |
GNU C++17 |
TESTS |
120 |
561 |
41267200 |
|
2600 |
69146328 |
U.M.R |
E |
Jan. 19, 2020, 3:37 p.m. |
OK |
GNU C++17 |
TESTS |
120 |
592 |
32870400 |
|
2600 |
57837123 |
congmingyige |
E |
July 27, 2019, 7:58 a.m. |
OK |
GNU C++17 |
TESTS |
120 |
592 |
41676800 |
|
2600 |
61700228 |
hjk1030 |
E |
Oct. 2, 2019, 8:18 a.m. |
OK |
GNU C++17 |
TESTS |
120 |
623 |
41267200 |
|
2600 |
35731053 |
vjudge2 |
E |
Feb. 26, 2018, 12:15 p.m. |
OK |
GNU C++17 |
TESTS |
120 |
639 |
109465600 |
|
2600 |
68358333 |
saketh |
E |
Jan. 7, 2020, 1:04 p.m. |
OK |
GNU C++17 |
TESTS |
120 |
654 |
22425600 |
|
2600 |
27382517 |
uwi |
E |
May 27, 2017, 10:49 a.m. |
OK |
Java 8 |
TESTS |
120 |
592 |
16793600 |
|
2600 |
27399240 |
niquefa_diego |
E |
May 28, 2017, 2:16 a.m. |
OK |
Java 8 |
TESTS |
120 |
997 |
67481600 |
|
2600 |
27550743 |
olya-chuchuk |
E |
June 3, 2017, 7:02 p.m. |
OK |
Java 8 |
TESTS |
120 |
1044 |
112128000 |
|
2600 |
27660755 |
tri |
E |
June 8, 2017, 12:53 a.m. |
OK |
Java 8 |
TESTS |
120 |
1060 |
63488000 |
|
2600 |
27750408 |
donli |
E |
June 13, 2017, 6:49 a.m. |
OK |
Java 8 |
TESTS |
120 |
1075 |
79872000 |
|
2600 |
27751537 |
donli |
E |
June 13, 2017, 8:17 a.m. |
OK |
Java 8 |
TESTS |
120 |
1247 |
61132800 |
|
2600 |
27428156 |
WoodcutKnife |
E |
May 29, 2017, 11:27 a.m. |
OK |
Java 8 |
TESTS |
120 |
1310 |
74854400 |
|
2600 |
29315165 |
jport |
E |
Aug. 10, 2017, 12:35 a.m. |
OK |
Java 8 |
TESTS |
120 |
1637 |
84172800 |
|
2600 |
32037560 |
yeputons |
E |
Nov. 3, 2017, 9:30 p.m. |
OK |
Kotlin |
TESTS |
120 |
1621 |
101785600 |
|
2600 |
32037602 |
yeputons |
E |
Nov. 3, 2017, 9:32 p.m. |
OK |
Kotlin |
TESTS |
120 |
1965 |
100761600 |
|
2600 |
67572021 |
dell_ |
E |
Dec. 24, 2019, 10:38 p.m. |
OK |
MS C++ 2017 |
TESTS |
120 |
1871 |
34713600 |
|
2600 |
remove filters
Back to search problems