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 |
601
|
Codeforces Round 333 (Div. 1) |
FINISHED |
False |
7200 |
283440299 |
Nov. 24, 2015, 4:35 p.m. |
Problems
B"You are given a tree T with n vertices (numbered 1 through n) and a letter in each vertex. The tree is rooted at vertex 1. Let's look at the subtree Tv of some vertex v. It is possible to read a string along each simple path starting at v and ending at some vertex in Tv (possibly v itself). Let's denote the number of distinct strings which can be read this way as . Also, there's a number cv assigned to each vertex v. We are interested in vertices with the maximum value of . You should compute two statistics: the maximum value of and the number of vertices v with the maximum . The first line of the input contains one integer n (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89300 xe2 x80 x89000) -- the number of vertices of the tree. The second line contains n space-separated integers ci (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ci xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109). The third line contains a string s consisting of n lowercase English letters -- the i-th character of this string is the letter in vertex i. The following n xe2 x80 x89- xe2 x80 x891 lines describe the tree T. Each of them contains two space-separated integers u and v (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89u, xe2 x80 x89v xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n) indicating an edge between vertices u and v. It's guaranteed that the input will describe a tree. Print two lines. On the first line, print over all 1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89i xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n. On the second line, print the number of vertices v for which . In the first sample, the tree looks like this: The sets of strings that can be read from individual vertices are: Finally, the values of are: In the second sample, the values of are (5, xe2 x80 x894, xe2 x80 x892, xe2 x80 x891, xe2 x80 x891, xe2 x80 x891). The distinct strings read in T2 are ; note that can be read down to vertices 3 or 4."... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
14836471 |
dohonghuan |
D |
Dec. 16, 2015, 3:47 p.m. |
OK |
FPC |
TESTS |
73 |
234 |
48332800 |
|
2400 |
14836533 |
dohonghuan |
D |
Dec. 16, 2015, 3:53 p.m. |
OK |
FPC |
TESTS |
73 |
249 |
48332800 |
|
2400 |
14557640 |
ez_zkj |
D |
Nov. 29, 2015, 12:18 p.m. |
OK |
FPC |
TESTS |
73 |
280 |
47206400 |
|
2400 |
14650769 |
FrostStar |
D |
Dec. 4, 2015, 3:56 p.m. |
OK |
FPC |
TESTS |
73 |
374 |
47513600 |
|
2400 |
18105109 |
vjtest |
D |
May 26, 2016, 1:49 p.m. |
OK |
GNU C++ |
TESTS |
73 |
109 |
61849600 |
|
2400 |
18105154 |
vjtest |
D |
May 26, 2016, 1:52 p.m. |
OK |
GNU C++ |
TESTS |
73 |
124 |
61849600 |
|
2400 |
18099358 |
vjtest |
D |
May 26, 2016, 6:53 a.m. |
OK |
GNU C++ |
TESTS |
73 |
124 |
61849600 |
|
2400 |
18098879 |
htnhtn |
D |
May 26, 2016, 6:20 a.m. |
OK |
GNU C++ |
TESTS |
73 |
124 |
61849600 |
|
2400 |
27938857 |
DFOIXjc |
D |
June 21, 2017, 6:51 a.m. |
OK |
GNU C++ |
TESTS |
73 |
139 |
61440000 |
|
2400 |
18099052 |
vjtest |
D |
May 26, 2016, 6:33 a.m. |
OK |
GNU C++ |
TESTS |
73 |
139 |
61849600 |
|
2400 |
18098918 |
vjtest |
D |
May 26, 2016, 6:22 a.m. |
OK |
GNU C++ |
TESTS |
73 |
139 |
61849600 |
|
2400 |
27906477 |
jiyutian |
D |
June 19, 2017, 2:14 p.m. |
OK |
GNU C++ |
TESTS |
73 |
140 |
54067200 |
|
2400 |
18099384 |
vjtest |
D |
May 26, 2016, 6:55 a.m. |
OK |
GNU C++ |
TESTS |
73 |
140 |
61849600 |
|
2400 |
18098940 |
vjtest |
D |
May 26, 2016, 6:24 a.m. |
OK |
GNU C++ |
TESTS |
73 |
140 |
61952000 |
|
2400 |
61087171 |
rainboy |
D |
Sept. 22, 2019, 6:52 p.m. |
OK |
GNU C11 |
TESTS |
73 |
374 |
31744000 |
|
2400 |
19433360 |
Oktavia |
D |
July 27, 2016, 4:27 a.m. |
OK |
GNU C++11 |
TESTS |
73 |
109 |
55398400 |
|
2400 |
19433870 |
Oktavia |
D |
July 27, 2016, 5:26 a.m. |
OK |
GNU C++11 |
TESTS |
73 |
109 |
55398400 |
|
2400 |
64738644 |
vjudge2 |
D |
Nov. 12, 2019, 11:14 a.m. |
OK |
GNU C++11 |
TESTS |
73 |
124 |
51814400 |
|
2400 |
40985626 |
ReaLNero1 |
D |
July 30, 2018, 8:03 p.m. |
OK |
GNU C++11 |
TESTS |
73 |
124 |
55398400 |
|
2400 |
14706228 |
IzumiKonata |
D |
Dec. 9, 2015, 4:40 a.m. |
OK |
GNU C++11 |
TESTS |
73 |
124 |
57651200 |
|
2400 |
33089659 |
_Sakits |
D |
Dec. 11, 2017, 5:43 a.m. |
OK |
GNU C++11 |
TESTS |
73 |
155 |
84480000 |
|
2400 |
16737780 |
immortalCO |
D |
March 16, 2016, 5:14 a.m. |
OK |
GNU C++11 |
TESTS |
73 |
171 |
64512000 |
|
2400 |
43941682 |
yasugongshang |
D |
Oct. 7, 2018, 11:44 a.m. |
OK |
GNU C++11 |
TESTS |
73 |
171 |
82432000 |
|
2400 |
33089701 |
_Sakits |
D |
Dec. 11, 2017, 5:48 a.m. |
OK |
GNU C++11 |
TESTS |
73 |
171 |
84480000 |
|
2400 |
57561821 |
luojinyao |
D |
July 23, 2019, 1:14 a.m. |
OK |
GNU C++11 |
TESTS |
73 |
171 |
255897600 |
|
2400 |
46918419 |
orbitingflea |
D |
Dec. 12, 2018, 12:33 a.m. |
OK |
GNU C++14 |
TESTS |
73 |
358 |
93286400 |
|
2400 |
49954536 |
Tosic |
D |
Feb. 15, 2019, 3:26 p.m. |
OK |
GNU C++14 |
TESTS |
73 |
374 |
64819200 |
|
2400 |
33007446 |
DatVu |
D |
Dec. 7, 2017, 6:07 p.m. |
OK |
GNU C++14 |
TESTS |
73 |
389 |
62668800 |
|
2400 |
56407247 |
RobeZH |
D |
July 1, 2019, 8:10 p.m. |
OK |
GNU C++14 |
TESTS |
73 |
389 |
122880000 |
|
2400 |
36306228 |
sava-cska |
D |
March 15, 2018, 3:42 p.m. |
OK |
GNU C++14 |
TESTS |
73 |
405 |
65433600 |
|
2400 |
23641165 |
xiaoxiaobaozi |
D |
Jan. 8, 2017, 6:39 a.m. |
OK |
GNU C++14 |
TESTS |
73 |
405 |
530227200 |
|
2400 |
23475826 |
Ali.Pi |
D |
Dec. 31, 2016, 9:36 p.m. |
OK |
GNU C++14 |
TESTS |
73 |
420 |
56627200 |
|
2400 |
35973838 |
kuppu |
D |
March 5, 2018, 5:55 p.m. |
OK |
GNU C++14 |
TESTS |
73 |
436 |
56524800 |
|
2400 |
38932882 |
vjudge5 |
D |
June 4, 2018, 2:16 a.m. |
OK |
GNU C++14 |
TESTS |
73 |
436 |
64204800 |
|
2400 |
46745870 |
Beast_Within |
D |
Dec. 8, 2018, 6:45 a.m. |
OK |
GNU C++14 |
TESTS |
73 |
436 |
67379200 |
|
2400 |
68032335 |
ruo |
D |
Jan. 1, 2020, 10:02 a.m. |
OK |
GNU C++17 |
TESTS |
73 |
373 |
58470400 |
|
2400 |
59641288 |
ST_C |
D |
Aug. 29, 2019, 1:51 a.m. |
OK |
GNU C++17 |
TESTS |
73 |
374 |
54476800 |
|
2400 |
49917732 |
ivan100sic |
D |
Feb. 14, 2019, 5:15 p.m. |
OK |
GNU C++17 |
TESTS |
73 |
405 |
227020800 |
|
2400 |
42364875 |
Fly_37 |
D |
Sept. 2, 2018, 1:59 p.m. |
OK |
GNU C++17 |
TESTS |
73 |
420 |
57548800 |
|
2400 |
67447779 |
BessieTheCow |
D |
Dec. 23, 2019, 12:19 a.m. |
OK |
GNU C++17 |
TESTS |
73 |
421 |
62976000 |
|
2400 |
49948872 |
Atreus |
D |
Feb. 15, 2019, 1:14 p.m. |
OK |
GNU C++17 |
TESTS |
73 |
421 |
137216000 |
|
2400 |
47364884 |
Minnakhmetov |
D |
Dec. 22, 2018, 10:55 a.m. |
OK |
GNU C++17 |
TESTS |
73 |
421 |
153702400 |
|
2400 |
42960815 |
KATATONIA |
D |
Sept. 16, 2018, 7 p.m. |
OK |
GNU C++17 |
TESTS |
73 |
436 |
58470400 |
|
2400 |
53743422 |
TienDungz |
D |
May 4, 2019, 3:11 p.m. |
OK |
GNU C++17 |
TESTS |
73 |
436 |
103526400 |
|
2400 |
42023088 |
kempusss |
D |
Aug. 24, 2018, 10:26 a.m. |
OK |
GNU C++17 |
TESTS |
73 |
451 |
57548800 |
|
2400 |
14533904 |
edorundo |
D |
Nov. 28, 2015, 3:58 a.m. |
OK |
Java 7 |
TESTS |
73 |
2527 |
521420800 |
|
2400 |
16869566 |
Sumeet.Varma |
D |
March 22, 2016, 11:54 a.m. |
OK |
Java 8 |
TESTS |
73 |
935 |
175104000 |
|
2400 |
14450174 |
uwi |
D |
Nov. 24, 2015, 5:24 p.m. |
OK |
Java 8 |
TESTS |
73 |
1060 |
54374400 |
|
2400 |
14452569 |
mmaxio |
D |
Nov. 24, 2015, 5:47 p.m. |
OK |
Java 8 |
TESTS |
73 |
1123 |
89088000 |
|
2400 |
14460031 |
Lewin |
D |
Nov. 24, 2015, 10:08 p.m. |
OK |
Java 8 |
TESTS |
73 |
1138 |
180838400 |
|
2400 |
14466821 |
Ruins |
D |
Nov. 25, 2015, 9:57 a.m. |
OK |
Java 8 |
TESTS |
73 |
1310 |
286720000 |
|
2400 |
33029549 |
prabhat236218 |
D |
Dec. 8, 2017, 5:29 p.m. |
OK |
Java 8 |
TESTS |
73 |
1434 |
266035200 |
|
2400 |
15431938 |
antonkov |
D |
Jan. 18, 2016, 7:23 p.m. |
OK |
Java 8 |
TESTS |
73 |
1528 |
241459200 |
|
2400 |
61087170 |
Dukkha |
D |
Sept. 22, 2019, 6:52 p.m. |
OK |
Java 8 |
TESTS |
73 |
1637 |
50688000 |
|
2400 |
15395884 |
qwerty787788 |
D |
Jan. 15, 2016, 11:05 p.m. |
OK |
Java 8 |
TESTS |
73 |
1653 |
323379200 |
|
2400 |
22829168 |
alibaba |
D |
Dec. 9, 2016, 8:46 a.m. |
OK |
Java 8 |
TESTS |
73 |
1684 |
233984000 |
|
2400 |
17844939 |
camypaper |
D |
May 11, 2016, 2:57 p.m. |
OK |
MS C# |
TESTS |
73 |
1591 |
109875200 |
|
2400 |
17844903 |
camypaper |
D |
May 11, 2016, 2:53 p.m. |
OK |
MS C# |
TESTS |
73 |
1669 |
144588800 |
|
2400 |
14453997 |
Taube |
D |
Nov. 24, 2015, 6:02 p.m. |
OK |
MS C++ |
TESTS |
73 |
420 |
52940800 |
|
2400 |
14687156 |
tangshitao |
D |
Dec. 7, 2015, 2:18 p.m. |
OK |
MS C++ |
TESTS |
73 |
545 |
39424000 |
|
2400 |
14886953 |
Xhark |
D |
Dec. 19, 2015, 4:39 p.m. |
OK |
MS C++ |
TESTS |
73 |
763 |
82022400 |
|
2400 |
14452552 |
josdas |
D |
Nov. 24, 2015, 5:47 p.m. |
OK |
MS C++ |
TESTS |
73 |
857 |
410931200 |
|
2400 |
16508891 |
sister_what_hate_most |
D |
March 4, 2016, 5:14 a.m. |
OK |
MS C++ |
TESTS |
73 |
873 |
148787200 |
|
2400 |
16508850 |
vjudge3 |
D |
March 4, 2016, 5:09 a.m. |
OK |
MS C++ |
TESTS |
73 |
873 |
148787200 |
|
2400 |
14571032 |
Carups |
D |
Nov. 30, 2015, 1:29 p.m. |
OK |
MS C++ |
TESTS |
73 |
997 |
90828800 |
|
2400 |
14508259 |
AleksanderBalobanov |
D |
Nov. 27, 2015, 9:05 a.m. |
OK |
MS C++ |
TESTS |
73 |
1232 |
473497600 |
|
2400 |
14452570 |
RomaWhite |
D |
Nov. 24, 2015, 5:47 p.m. |
OK |
MS C++ |
TESTS |
73 |
1263 |
117248000 |
|
2400 |
14508252 |
AleksanderBalobanov |
D |
Nov. 27, 2015, 9:05 a.m. |
OK |
MS C++ |
TESTS |
73 |
1388 |
501452800 |
|
2400 |
67447742 |
BessieTheCow |
D |
Dec. 23, 2019, 12:17 a.m. |
OK |
MS C++ 2017 |
TESTS |
73 |
966 |
64716800 |
|
2400 |
remove filters
Back to search problems