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'This is the medium version of the problem. The difference in this version is that t=1 and we work on trees. Ron and Hermione are playing a game on a tree of n nodes that are initially inactive. The game consists of t rounds, each of which starts with a stone on exactly one node, which is considered as activated. A move consists of picking an inactive neighbor of the node with a stone on it and moving the stone there (thus activating this neighbor). Ron makes the first move, after which he alternates with Hermione until no valid move is available. The player that cannot make a move loses the round. If both players play optimally, who wins each round of this game? Note that all the rounds are played with the same tree; only the starting node changes. Moreover, after each round, all active nodes are considered inactive again. The first line contains integers n ( 2 <= q n <= q 2 x 10^5 ), t ( t=1 ), the number of nodes in the tree and the number of rounds, respectively. The next n-1 lines contain two integers 1 <= q u, v <= q n each, corresponding to an edge of the tree. The next line contains t integers 1 <= q u_1 , ... , u_t <= q n , corresponding to the node where the stone is initially put. The output consists of t=1 line which is either "Ron" or "Hermione". '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
260915121 |
Magg724 |
C2 |
May 14, 2024, 11:12 a.m. |
OK |
C# 10 |
TESTS |
14 |
327 |
21094400 |
|
1700 |
260702322 |
duyiblue |
C2 |
May 12, 2024, 6:21 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
14 |
140 |
8192000 |
|
1700 |
261946779 |
huangyuheng |
C2 |
May 21, 2024, 1:02 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
14 |
156 |
4812800 |
|
1700 |
262154662 |
Ccii |
C2 |
May 22, 2024, 1:50 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
14 |
156 |
7987200 |
|
1700 |
263134215 |
guaidaokakaxi |
C2 |
May 29, 2024, 11:38 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
14 |
171 |
3174400 |
|
1700 |
259659618 |
LaMatematica14 |
C2 |
May 5, 2024, 4:38 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
14 |
171 |
3174400 |
|
1700 |
262813126 |
thumbass |
C2 |
May 27, 2024, 1:49 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
14 |
171 |
4710400 |
|
1700 |
261013773 |
tritruong |
C2 |
May 15, 2024, 6:56 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
14 |
171 |
16793600 |
|
1700 |
260860023 |
lby2014 |
C2 |
May 13, 2024, 10:24 p.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
14 |
186 |
3891200 |
|
1700 |
259861923 |
rozan_nich |
C2 |
May 7, 2024, 10:48 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
14 |
187 |
4710400 |
|
1700 |
260768316 |
429d51579a491c57 |
C2 |
May 13, 2024, 8:57 a.m. |
OK |
C++14 (GCC 6-32) |
TESTS |
14 |
202 |
3891200 |
|
1700 |
259836827 |
MKL220017070 |
C2 |
May 7, 2024, 6:58 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
14 |
109 |
24064000 |
|
1700 |
261283943 |
Darshanraj |
C2 |
May 17, 2024, 6:01 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
14 |
124 |
5632000 |
|
1700 |
259818297 |
MKL220017070 |
C2 |
May 7, 2024, 2:47 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
14 |
124 |
20070400 |
|
1700 |
261168980 |
go_to_my_own_company |
C2 |
May 16, 2024, 8:59 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
14 |
139 |
4812800 |
|
1700 |
262048530 |
Vsg21 |
C2 |
May 21, 2024, 4:22 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
14 |
140 |
8089600 |
|
1700 |
259837384 |
MKL220017070 |
C2 |
May 7, 2024, 7:03 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
14 |
140 |
24064000 |
|
1700 |
259821718 |
MKL220017070 |
C2 |
May 7, 2024, 3:45 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
14 |
140 |
24064000 |
|
1700 |
262937058 |
Mayur_coder |
C2 |
May 27, 2024, 10:06 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
14 |
171 |
3072000 |
|
1700 |
259581893 |
vjudge1 |
C2 |
May 5, 2024, 4:23 a.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
14 |
171 |
3072000 |
|
1700 |
263388647 |
bhanu0312pratap |
C2 |
May 30, 2024, 9:36 p.m. |
OK |
C++17 (GCC 7-32) |
TESTS |
14 |
171 |
3174400 |
|
1700 |
259942567 |
HaitaoWang |
C2 |
May 8, 2024, 3:07 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
14 |
108 |
5017600 |
|
1700 |
262948037 |
xgyxgy |
C2 |
May 28, 2024, 2:41 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
14 |
109 |
16076800 |
|
1700 |
260684266 |
SMDS |
C2 |
May 12, 2024, 3:24 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
14 |
124 |
6553600 |
|
1700 |
259789074 |
_Kee |
C2 |
May 6, 2024, 6:04 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
14 |
124 |
28467200 |
|
1700 |
260648367 |
zheqing |
C2 |
May 12, 2024, 10:36 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
14 |
139 |
64102400 |
|
1700 |
261081418 |
SMDS |
C2 |
May 15, 2024, 4:29 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
14 |
140 |
4403200 |
|
1700 |
262100036 |
17f |
C2 |
May 22, 2024, 6:41 a.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
14 |
140 |
9625600 |
|
1700 |
259792478 |
_Kee |
C2 |
May 6, 2024, 6:37 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
14 |
140 |
11366400 |
|
1700 |
259640041 |
maspy |
C2 |
May 5, 2024, 1:40 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
14 |
140 |
17920000 |
|
1700 |
262807356 |
deceptive |
C2 |
May 26, 2024, 11:01 p.m. |
OK |
C++20 (GCC 13-64) |
TESTS |
14 |
155 |
7577600 |
|
1700 |
261294524 |
cpy |
C2 |
May 17, 2024, 7:43 a.m. |
OK |
D |
TESTS |
14 |
359 |
21504000 |
|
1700 |
259995639 |
timiss |
C2 |
May 8, 2024, 12:11 p.m. |
OK |
GNU C11 |
TESTS |
14 |
124 |
5734400 |
|
1700 |
262046362 |
stolis |
C2 |
May 21, 2024, 4:05 p.m. |
OK |
Java 21 |
TESTS |
14 |
468 |
18739200 |
|
1700 |
260604816 |
hemant |
C2 |
May 12, 2024, 4:03 a.m. |
OK |
Java 21 |
TESTS |
14 |
593 |
40448000 |
|
1700 |
260742961 |
mohit1510 |
C2 |
May 13, 2024, 4:59 a.m. |
OK |
Java 21 |
TESTS |
14 |
656 |
28364800 |
|
1700 |
259645245 |
Crazypy |
C2 |
May 5, 2024, 2:27 p.m. |
OK |
Java 21 |
TESTS |
14 |
734 |
34508800 |
|
1700 |
261231750 |
Sudip809 |
C2 |
May 16, 2024, 5:08 p.m. |
OK |
Java 21 |
TESTS |
14 |
765 |
30515200 |
|
1700 |
263588086 |
man-ray |
C2 |
June 1, 2024, 6:58 a.m. |
OK |
Java 21 |
TESTS |
14 |
765 |
34508800 |
|
1700 |
259498795 |
dzhi |
C2 |
May 4, 2024, 11:15 a.m. |
OK |
Java 21 |
TESTS |
13 |
890 |
77721600 |
|
1700 |
261423094 |
amrit231999 |
C2 |
May 17, 2024, 6:26 p.m. |
OK |
Java 8 |
TESTS |
14 |
499 |
80076800 |
|
1700 |
261471255 |
interval_06 |
C2 |
May 18, 2024, 6:32 a.m. |
OK |
Java 8 |
TESTS |
14 |
514 |
41984000 |
|
1700 |
260760920 |
coderman2004 |
C2 |
May 13, 2024, 7:40 a.m. |
OK |
Java 8 |
TESTS |
14 |
593 |
28876800 |
|
1700 |
261233936 |
scorpiocat |
C2 |
May 16, 2024, 5:26 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
374 |
56422400 |
|
1700 |
262498785 |
Calvin65 |
C2 |
May 25, 2024, 10:50 a.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
483 |
29696000 |
|
1700 |
259965066 |
reijnnn |
C2 |
May 8, 2024, 7:39 a.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
484 |
37888000 |
|
1700 |
262947185 |
accelerate_nju |
C2 |
May 28, 2024, 2:26 a.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
484 |
50995200 |
|
1700 |
262498316 |
Calvin65 |
C2 |
May 25, 2024, 10:46 a.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
562 |
28057600 |
|
1700 |
262812084 |
TJacobus |
C2 |
May 27, 2024, 1:21 a.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
592 |
36044800 |
|
1700 |
260451332 |
aha66 |
C2 |
May 10, 2024, 7:56 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
593 |
42700800 |
|
1700 |
259551245 |
edugong |
C2 |
May 4, 2024, 7:09 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
624 |
28876800 |
|
1700 |
260505994 |
khan_ali |
C2 |
May 11, 2024, 7:50 a.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
639 |
56320000 |
|
1700 |
261232654 |
scorpiocat |
C2 |
May 16, 2024, 5:15 p.m. |
OK |
PyPy 3-64 |
TESTS |
14 |
639 |
57753600 |
|
1700 |
262858701 |
2210080018 |
C2 |
May 27, 2024, 9:39 a.m. |
OK |
Python 3 |
TESTS |
14 |
718 |
44441600 |
|
1700 |
260870452 |
just_average_ok |
C2 |
May 14, 2024, 2:59 a.m. |
OK |
Python 3 |
TESTS |
14 |
718 |
44441600 |
|
1700 |
259497514 |
randombernie DreadedHippy Ehijoe |
C2 |
May 4, 2024, 11:05 a.m. |
OK |
Python 3 |
TESTS |
13 |
718 |
45875200 |
|
1700 |
260862344 |
JakeMate14 |
C2 |
May 13, 2024, 11:42 p.m. |
OK |
Python 3 |
TESTS |
14 |
765 |
66764800 |
|
1700 |
263535454 |
Ajay_Vijendran |
C2 |
May 31, 2024, 5:50 p.m. |
OK |
Python 3 |
TESTS |
14 |
827 |
44441600 |
|
1700 |
260555615 |
scorpiocat |
C2 |
May 11, 2024, 3:37 p.m. |
OK |
Python 3 |
TESTS |
14 |
889 |
42291200 |
|
1700 |
259834921 |
BetterThanNobita |
C2 |
May 7, 2024, 6:39 a.m. |
OK |
Rust 2021 |
TESTS |
14 |
171 |
13107200 |
|
1700 |
261696729 |
mikkk |
C2 |
May 19, 2024, 7:31 p.m. |
OK |
Rust 2021 |
TESTS |
14 |
265 |
13824000 |
|
1700 |
remove filters
Back to search problems