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'Since astronauts from BubbleCup XI mission finished their mission on the Moon and are big fans of famous singer, they decided to spend some fun time before returning to the Earth and hence created a so called "Moonwalk challenge" game. Teams of astronauts are given the map of craters on the Moon and direct bidirectional paths from some craters to others that are safe for "Moonwalking". Each of those direct paths is colored in one color and there is unique path between each two craters. Goal of the game is to find two craters such that given array of colors appears most times as continuous subarray on the path between those two craters (overlapping appearances should be counted). To help your favorite team win, you should make a program that, given the map, answers the queries of the following type: For two craters and array of colors answer how many times given array appears as continuous subarray on the path from the first crater to the second. Colors are represented as lowercase English alphabet letters. In the first line, integer N (2 <= q N <= q 10^5) -- number of craters on the Moon. Craters are numerated with numbers 1 to N . In next N-1 lines, three values u, v, L (1 <= q u, v <= q N, L in {a, ..., z }) -- denoting that there is a direct path with color L between craters u and v . Next line contains integer Q (1 <= q Q <= q 10^5) -- number of queries. Next Q lines contain three values u, v (1 <= q u, v <= q N) and S (|S| <= q 100) , where u and v are the two cratersfor which you should find how many times array of colors S (represented as string) appears on the path from u to v . For each query output one number that represents number of occurrences of array S on the path from u to v . '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
47830250 |
zjp_shadow |
J |
Jan. 2, 2019, 5:59 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
312 |
231424000 |
|
3000 |
43263705 |
zx2003 Dream-Reality |
J |
Sept. 22, 2018, 3:34 p.m. |
OK |
GNU C++11 |
TESTS |
20 |
358 |
60723200 |
|
3000 |
47869034 |
Hany01 |
J |
Jan. 3, 2019, 11:44 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
373 |
188006400 |
|
3000 |
47869631 |
Hany01 |
J |
Jan. 3, 2019, 12:04 p.m. |
OK |
GNU C++11 |
TESTS |
20 |
405 |
188006400 |
|
3000 |
47841557 |
great_influence |
J |
Jan. 2, 2019, 12:17 p.m. |
OK |
GNU C++11 |
TESTS |
20 |
421 |
106393600 |
|
3000 |
46994700 |
Pickupwin |
J |
Dec. 14, 2018, 7:38 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
670 |
135065600 |
|
3000 |
46994632 |
Pickupwin |
J |
Dec. 14, 2018, 7:36 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
686 |
166912000 |
|
3000 |
46782011 |
Demerzel_IV |
J |
Dec. 9, 2018, 3:24 a.m. |
OK |
GNU C++11 |
TESTS |
20 |
1294 |
214118400 |
|
3000 |
43575980 |
krijgertje |
J |
Sept. 29, 2018, 2:57 p.m. |
OK |
GNU C++11 |
TESTS |
20 |
1934 |
47616000 |
|
3000 |
45205140 |
zjczzzjczjczzzjc |
J |
Nov. 2, 2018, 12:19 p.m. |
OK |
GNU C++11 |
TESTS |
20 |
2245 |
124723200 |
|
3000 |
50994850 |
luogu_bot5 |
J |
March 8, 2019, 2:44 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
405 |
267059200 |
|
3000 |
47861759 |
zhou888 |
J |
Jan. 3, 2019, 6:36 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
436 |
129433600 |
|
3000 |
47845842 |
zhou888 |
J |
Jan. 2, 2019, 2:37 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
483 |
100044800 |
|
3000 |
47873208 |
hyj542682306 |
J |
Jan. 3, 2019, 1:57 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
483 |
266752000 |
|
3000 |
57308875 |
vjudge3 |
J |
July 19, 2019, 5:34 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
639 |
108953600 |
|
3000 |
47840495 |
dengyixuan |
J |
Jan. 2, 2019, 11:36 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
717 |
228249600 |
|
3000 |
57874707 |
-osdajigu- |
J |
July 28, 2019, 4:28 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
1419 |
40652800 |
|
3000 |
57874627 |
-osdajigu- |
J |
July 28, 2019, 4:25 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
1450 |
40652800 |
|
3000 |
53711591 |
Minnakhmetov |
J |
May 3, 2019, 3:56 p.m. |
OK |
GNU C++14 |
TESTS |
20 |
2386 |
103424000 |
|
3000 |
43440859 |
yfzcsc |
J |
Sept. 26, 2018, 8:57 a.m. |
OK |
GNU C++14 |
TESTS |
20 |
2854 |
256921600 |
|
3000 |
46755579 |
mtmohim |
J |
Dec. 8, 2018, 11:32 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
1075 |
244633600 |
|
3000 |
44751538 |
ReaLNero1 |
J |
Oct. 23, 2018, 8:12 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
1122 |
244940800 |
|
3000 |
43263676 |
Merkurev I_love_Tanya_Romanova Um_nik |
J |
Sept. 22, 2018, 3:33 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
1201 |
244736000 |
|
3000 |
43258702 |
LHiC |
J |
Sept. 22, 2018, 2:11 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
1700 |
59904000 |
|
3000 |
43260133 |
ainta |
J |
Sept. 22, 2018, 2:33 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
1762 |
184832000 |
|
3000 |
43262712 |
xtalclr nong ko_osaga |
J |
Sept. 22, 2018, 3:18 p.m. |
OK |
GNU C++17 |
TESTS |
20 |
1949 |
180736000 |
|
3000 |
57713154 |
vjudge5 |
J |
July 25, 2019, 1:21 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
2792 |
47001600 |
|
3000 |
57171308 |
vjudge3 |
J |
July 17, 2019, 3:12 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
2932 |
44953600 |
|
3000 |
57713099 |
Juaanma |
J |
July 25, 2019, 1:20 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
3150 |
46899200 |
|
3000 |
43894254 |
_LeMur_ |
J |
Oct. 6, 2018, 10:22 a.m. |
OK |
GNU C++17 |
TESTS |
20 |
4617 |
39219200 |
|
3000 |
57975337 |
idgaf |
J |
July 30, 2019, 7:30 a.m. |
OK |
Java 8 |
TESTS |
20 |
3291 |
137420800 |
|
3000 |
57975550 |
idgaf |
J |
July 30, 2019, 7:34 a.m. |
OK |
Java 8 |
TESTS |
20 |
3338 |
137318400 |
|
3000 |
57975652 |
idgaf |
J |
July 30, 2019, 7:36 a.m. |
OK |
Java 8 |
TESTS |
20 |
3400 |
137420800 |
|
3000 |
remove filters
Back to search problems