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'Toad Ilya has a rooted binary tree with vertex 1 being the root. A tree is a connected graph without cycles. A tree is rooted if one vertex is selected and called the root. A vertex u is a child of a vertex v if u and v are connected by an edge and v is closer to the root than u . A leaf is a non-root vertex that has no children. In the tree Ilya has each vertex has at most two children, and each edge has some character written on it. The character can be a lowercase English letter or the question mark '? '. Ilya will q times update the tree a bit. Each update will replace exactly one character on some edge. After each update Ilya needs to find if the tree is anagrammable and if yes, find its anagramnity for each letter. Well, that 's difficult to explain, but we 'll try. To start with, a string a is an anagram of a string b if it is possible to rearrange letters in a (without changing the letters itself) so that it becomes b . For example, the string "fortyfive" is an anagram of the string "overfifty", but the string "aabb" is not an anagram of the string "bbba". Consider a path from the root of the tree to a leaf. The characters on the edges on this path form a string, we say that this string is associated with this leaf. The tree is anagrammable if and only if it is possible to replace each question mark with a lowercase English letter so that for all pair of leaves the associated strings for these leaves are anagrams of each other. If the tree is anagrammable, then its anagramnity for the letter c is the maximum possible number of letters c in a string associated with some leaf in a valid replacement of all question marks. Please after each update find if the tree is anagrammable and if yes, find the sum{f(c) cdot ind(c)} for all letters c , where f(c) is the anagramnity for the letter c , and ind(x) is the index of this letter in the alphabet ('... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
54690084 |
1919810 |
D |
May 26, 2019, 5:16 p.m. |
OK |
GNU C++11 |
TESTS |
122 |
249 |
45465600 |
|
2900 |
55848804 |
liuzhangfeiabc |
D |
June 21, 2019, 1:25 a.m. |
OK |
GNU C++11 |
TESTS |
122 |
327 |
41472000 |
|
2900 |
54784740 |
WZYYN |
D |
May 29, 2019, 2:45 a.m. |
OK |
GNU C++11 |
TESTS |
122 |
327 |
52940800 |
|
2900 |
55226021 |
frodakcin |
D |
June 7, 2019, 1:26 a.m. |
OK |
GNU C++11 |
TESTS |
122 |
421 |
51712000 |
|
2900 |
59515639 |
spacevortex |
D |
Aug. 26, 2019, 10:04 a.m. |
OK |
GNU C++11 |
TESTS |
122 |
436 |
82944000 |
|
2900 |
63554619 |
Amorphophallus |
D |
Oct. 27, 2019, 12:32 p.m. |
OK |
GNU C++11 |
TESTS |
122 |
452 |
62464000 |
|
2900 |
55708650 |
_twilight |
D |
June 18, 2019, 9:03 a.m. |
OK |
GNU C++11 |
TESTS |
122 |
483 |
44646400 |
|
2900 |
58895501 |
idxcalccalc |
D |
Aug. 16, 2019, 7:23 a.m. |
OK |
GNU C++11 |
TESTS |
122 |
546 |
40652800 |
|
2900 |
54784267 |
daklqw |
D |
May 29, 2019, 2:18 a.m. |
OK |
GNU C++11 |
TESTS |
122 |
576 |
51097600 |
|
2900 |
66036551 |
yaren |
D |
Nov. 30, 2019, 11:59 a.m. |
OK |
GNU C++11 |
TESTS |
122 |
576 |
88064000 |
|
2900 |
54745409 |
krijgertje |
D |
May 28, 2019, 10:18 a.m. |
OK |
GNU C++14 |
TESTS |
122 |
187 |
61440000 |
|
2900 |
55610808 |
ReaLNero1 |
D |
June 16, 2019, 5:36 a.m. |
OK |
GNU C++14 |
TESTS |
122 |
202 |
61440000 |
|
2900 |
54898112 |
sajibreadd |
D |
June 1, 2019, 4:39 a.m. |
OK |
GNU C++14 |
TESTS |
122 |
233 |
86016000 |
|
2900 |
54784702 |
yasugongshang |
D |
May 29, 2019, 2:43 a.m. |
OK |
GNU C++14 |
TESTS |
122 |
296 |
43008000 |
|
2900 |
54821108 |
mayaohua2003 |
D |
May 30, 2019, 2:48 a.m. |
OK |
GNU C++14 |
TESTS |
122 |
327 |
57856000 |
|
2900 |
54823781 |
mobu233 |
D |
May 30, 2019, 5:10 a.m. |
OK |
GNU C++14 |
TESTS |
122 |
342 |
39833600 |
|
2900 |
54693988 |
Kostroma |
D |
May 26, 2019, 6:19 p.m. |
OK |
GNU C++14 |
TESTS |
122 |
342 |
43827200 |
|
2900 |
57255177 |
beginend |
D |
July 18, 2019, 2:07 a.m. |
OK |
GNU C++14 |
TESTS |
122 |
343 |
41472000 |
|
2900 |
54740500 |
KwanghyunOn |
D |
May 28, 2019, 7:38 a.m. |
OK |
GNU C++14 |
TESTS |
122 |
374 |
35942400 |
|
2900 |
54690951 |
receed |
D |
May 26, 2019, 5:21 p.m. |
OK |
GNU C++14 |
TESTS |
122 |
421 |
42291200 |
|
2900 |
54692817 |
Um_nik |
D |
May 26, 2019, 5:33 p.m. |
OK |
GNU C++17 |
TESTS |
122 |
187 |
47308800 |
|
2900 |
54715688 |
Roundgod |
D |
May 27, 2019, 1:08 p.m. |
OK |
GNU C++17 |
TESTS |
122 |
202 |
38809600 |
|
2900 |
54694558 |
zemen |
D |
May 26, 2019, 6:29 p.m. |
OK |
GNU C++17 |
TESTS |
122 |
358 |
67788800 |
|
2900 |
55305804 |
BinGoo0o0o |
D |
June 8, 2019, 2:20 p.m. |
OK |
GNU C++17 |
TESTS |
122 |
405 |
85401600 |
|
2900 |
54694416 |
cerberus97 |
D |
May 26, 2019, 6:26 p.m. |
OK |
GNU C++17 |
TESTS |
122 |
436 |
64204800 |
|
2900 |
61314335 |
wir |
D |
Sept. 26, 2019, 10:30 a.m. |
OK |
GNU C++17 |
TESTS |
122 |
483 |
191590400 |
|
2900 |
54687414 |
Errichto |
D |
May 26, 2019, 4:57 p.m. |
OK |
GNU C++17 |
TESTS |
122 |
498 |
189132800 |
|
2900 |
66146233 |
user202729_ |
D |
Dec. 1, 2019, 4:42 p.m. |
OK |
GNU C++17 |
TESTS |
122 |
545 |
36044800 |
|
2900 |
59631029 |
flashmt |
D |
Aug. 28, 2019, 6:07 p.m. |
OK |
GNU C++17 |
TESTS |
122 |
545 |
107315200 |
|
2900 |
59395408 |
Nakagawa.Kanon |
D |
Aug. 24, 2019, 10:07 a.m. |
OK |
GNU C++17 |
TESTS |
122 |
576 |
76902400 |
|
2900 |
54697142 |
Petr |
D |
May 26, 2019, 7:46 p.m. |
OK |
Java 8 |
TESTS |
122 |
420 |
39936000 |
|
2900 |
54808817 |
dalt |
D |
May 29, 2019, 3:39 p.m. |
OK |
Java 8 |
TESTS |
122 |
3041 |
75776000 |
|
2900 |
54739071 |
Petr |
D |
May 28, 2019, 6:46 a.m. |
OK |
Kotlin |
TESTS |
122 |
451 |
67788800 |
|
2900 |
remove filters
Back to search problems