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 |
1958
|
Kotlin Heroes: Episode 10 |
FINISHED |
False |
9000 |
21569063 |
May 13, 2024, 2:35 p.m. |
Problems
B"You are given two rooted trees, consisting of n vertices each. The vertices in the trees are numbered from 1 to n , and the root is the vertex 1 . You can perform the following operation: choose the tree and the vertex v (except the root of the tree) in it; connect the child nodes of v to the parent of v and remove v from the tree. Let's say that two trees are equal if both of the following conditions hold: Your task is to calculate the minimum number of aforementioned operation in order to make the trees equal. The first line contains a single integer n ( 2 <= n <= 40 ) -- the number of vertices in the trees. The second line contains n-1 integers a_2, a_3, ... , a_n ( 1 <= a_i <= n ), where a_i the parent of the i -th vertex in the first tree. Vertex 1 is the root. The third line contains n-1 integers b_2, b_3, ... , b_n ( 1 <= b_i <= n ), where b_i the parent of the i -th vertex in the second tree. Vertex 1 is the root. Print a single integer -- the minimum number of aforementioned operation in order to make the trees equal. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
262022214 |
Slata |
I |
May 21, 2024, 1:09 p.m. |
OK |
Kotlin 1.7 |
TESTS |
64 |
296 |
4812800 |
|
3100 |
260832833 |
Golovanov399 |
I |
May 13, 2024, 4:45 p.m. |
OK |
Kotlin 1.7 |
TESTS |
63 |
327 |
2252800 |
|
3100 |
261318861 |
chappy1 |
I |
May 17, 2024, 11:14 a.m. |
OK |
Kotlin 1.7 |
TESTS |
64 |
327 |
5939200 |
|
3100 |
262975338 |
Engineer |
I |
May 28, 2024, 7:37 a.m. |
OK |
Kotlin 1.7 |
TESTS |
64 |
327 |
6246400 |
|
3100 |
261427347 |
Mmourad2009 |
I |
May 17, 2024, 7:15 p.m. |
OK |
Kotlin 1.7 |
TESTS |
64 |
358 |
5734400 |
|
3100 |
261292325 |
Hamza_Refai |
I |
May 17, 2024, 7:22 a.m. |
OK |
Kotlin 1.7 |
TESTS |
64 |
374 |
5939200 |
|
3100 |
262311706 |
annak_s |
I |
May 23, 2024, 8:47 p.m. |
OK |
Kotlin 1.7 |
TESTS |
64 |
405 |
5529600 |
|
3100 |
262310993 |
YuriyKap |
I |
May 23, 2024, 8:35 p.m. |
OK |
Kotlin 1.7 |
TESTS |
64 |
405 |
5529600 |
|
3100 |
260947171 |
LeoPro |
I |
May 14, 2024, 3:19 p.m. |
OK |
Kotlin 1.7 |
TESTS |
64 |
421 |
24985600 |
|
3100 |
260832054 |
KostasKostil |
I |
May 13, 2024, 4:39 p.m. |
OK |
Kotlin 1.7 |
TESTS |
63 |
1437 |
91443200 |
|
3100 |
260999096 |
dzhi |
I |
May 15, 2024, 3:57 a.m. |
OK |
Kotlin 1.9 |
TESTS |
64 |
171 |
0 |
|
3100 |
260828363 |
tourist |
I |
May 13, 2024, 4:11 p.m. |
OK |
Kotlin 1.9 |
TESTS |
63 |
186 |
0 |
|
3100 |
261427431 |
Mmourad2009 |
I |
May 17, 2024, 7:16 p.m. |
OK |
Kotlin 1.9 |
TESTS |
64 |
187 |
102400 |
|
3100 |
260999138 |
nguyenquocthao00 |
I |
May 15, 2024, 3:57 a.m. |
OK |
Kotlin 1.9 |
TESTS |
64 |
202 |
409600 |
|
3100 |
260997088 |
nguyenquocthao00 |
I |
May 15, 2024, 3:21 a.m. |
OK |
Kotlin 1.9 |
TESTS |
64 |
202 |
1740800 |
|
3100 |
261300622 |
Yuvraj_2004 |
I |
May 17, 2024, 8:40 a.m. |
OK |
Kotlin 1.9 |
TESTS |
64 |
218 |
307200 |
|
3100 |
263167933 |
camc |
I |
May 29, 2024, 4:27 p.m. |
OK |
Kotlin 1.9 |
TESTS |
64 |
218 |
409600 |
|
3100 |
260824780 |
arvindf232 |
I |
May 13, 2024, 3:45 p.m. |
OK |
Kotlin 1.9 |
TESTS |
63 |
218 |
1228800 |
|
3100 |
261024707 |
nguyenquocthao00 |
I |
May 15, 2024, 8:39 a.m. |
OK |
Kotlin 1.9 |
TESTS |
64 |
218 |
1740800 |
|
3100 |
260834515 |
uwi |
I |
May 13, 2024, 4:59 p.m. |
OK |
Kotlin 1.9 |
TESTS |
63 |
218 |
1740800 |
|
3100 |
remove filters
Back to search problems