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"LuoTianyi gives you a tree with values in its vertices, and the root of the tree is vertex 1 . In one operation, you can change the value in one vertex to any non-negative integer. Now you need to find the minimum number of operations you need to perform to make each path from the root to leaf ^{ dagger} has a bitwise XOR value of zero. ^{ dagger} A leaf in a rooted tree is a vertex that has exactly one neighbor and is not a root. The first line contains a single integer n ( 2 <= n <= 10^5 ) -- the number of vertices in the tree. The second line contains n integers a_1, a_2, ldots, a_n ( 1 <= a_i <= 10^9 ), the i -th number represents the value in the i -th vertex. Next n xe2 x88 x921 lines describe the edges of the tree. The i -th line contains two integers u_i and v_i ( 1 <= u_i,v_i <= n, u_i neq v_i ) -- the vertices connected by an edge of the tree. It's guaranteed that the given edges form a tree. Print a single integer -- the minimum number of operations. The tree in the first example: If we change the value in the vertex 2 to 3 , the value in the vertex 5 to 4 , and the value in the vertex 6 to 6 , then the tree will be ok. The bitwise XOR from the root to the leaf 2 will be 3 oplus 3=0 . The bitwise XOR from the root to the leaf 5 will be 4 oplus 7 oplus 3=0 . The bitwise XOR from the root to the leaf 6 will be 6 oplus 5 oplus 3=0 . The tree in the second example: If we change the value in the vertex 2 to 4 , the value in the vertex 3 to 27 , and the value in the vertex 6 to 20 , then the tree will be ok. The bitwise XOR from the root to the leaf 6 will be 20 oplus 19 oplus 7=0 . The bitwise XOR from the root to the leaf 8 will be 11 oplus 27 oplus 4 oplus 19 oplus 7=0 . The bitwise XOR from the root to the leaf 4 will be 16 oplus"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
205930309 |
mban259 |
C |
May 15, 2023, 12:31 a.m. |
OK |
C# 10 |
TESTS |
78 |
545 |
63897600 |
|
2500 |
206198685 |
11d10xy |
C |
May 17, 2023, 10:49 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
140 |
23347200 |
|
2500 |
205293071 |
ErfanMirshams |
C |
May 10, 2023, 6:06 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
156 |
20582400 |
|
2500 |
205310472 |
C1942huangjiaxu |
C |
May 10, 2023, 9:39 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
156 |
105369600 |
|
2500 |
205214659 |
rrrrrzzzzzyyyyy |
C |
May 9, 2023, 11:11 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
171 |
20480000 |
|
2500 |
205171012 |
zltzlt |
C |
May 8, 2023, 11:21 p.m. |
OK |
GNU C++14 |
TESTS |
74 |
171 |
20889600 |
|
2500 |
205170976 |
zltzlt |
C |
May 8, 2023, 11:20 p.m. |
OK |
GNU C++14 |
TESTS |
74 |
171 |
20889600 |
|
2500 |
205186808 |
roohaande |
C |
May 9, 2023, 5:42 a.m. |
OK |
GNU C++14 |
TESTS |
74 |
171 |
21196800 |
|
2500 |
205178463 |
daniel14311531 |
C |
May 9, 2023, 2:52 a.m. |
OK |
GNU C++14 |
TESTS |
74 |
171 |
21196800 |
|
2500 |
205147496 |
sirikolipaka |
C |
May 8, 2023, 5:06 p.m. |
OK |
GNU C++14 |
TESTS |
74 |
171 |
21196800 |
|
2500 |
206197766 |
11d10xy |
C |
May 17, 2023, 10:39 a.m. |
OK |
GNU C++14 |
TESTS |
78 |
171 |
21811200 |
|
2500 |
205535534 |
erekle |
C |
May 12, 2023, 12:35 p.m. |
OK |
GNU C++17 |
TESTS |
78 |
155 |
21811200 |
|
2500 |
205533506 |
erekle |
C |
May 12, 2023, 12:16 p.m. |
OK |
GNU C++17 |
TESTS |
78 |
156 |
16998400 |
|
2500 |
205388478 |
gottipatiyasaswini |
C |
May 11, 2023, 4:48 a.m. |
OK |
GNU C++17 |
TESTS |
75 |
156 |
20889600 |
|
2500 |
205351221 |
Ahmed_Nassar |
C |
May 10, 2023, 4:28 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
156 |
22630400 |
|
2500 |
205349710 |
walk_alone |
C |
May 10, 2023, 4:12 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
156 |
22630400 |
|
2500 |
205201912 |
ZhihuiLiu |
C |
May 9, 2023, 9 a.m. |
OK |
GNU C++17 |
TESTS |
75 |
156 |
24473600 |
|
2500 |
205146539 |
2000030255 |
C |
May 8, 2023, 4:57 p.m. |
OK |
GNU C++17 |
TESTS |
74 |
171 |
16691200 |
|
2500 |
205205772 |
kiddy_z |
C |
May 9, 2023, 9:37 a.m. |
OK |
GNU C++17 |
TESTS |
75 |
171 |
18944000 |
|
2500 |
205341664 |
xxafhixx |
C |
May 10, 2023, 2:48 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
171 |
19353600 |
|
2500 |
205280806 |
over_thinker001 |
C |
May 10, 2023, 2:15 a.m. |
OK |
GNU C++17 |
TESTS |
75 |
171 |
19763200 |
|
2500 |
205335783 |
Antichain |
C |
May 10, 2023, 1:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
75 |
140 |
30822400 |
|
2500 |
205141931 |
LamKappa |
C |
May 8, 2023, 4:16 p.m. |
OK |
GNU C++17 (64) |
TESTS |
74 |
140 |
32870400 |
|
2500 |
205136397 |
YocyCraft |
C |
May 8, 2023, 3:28 p.m. |
OK |
GNU C++17 (64) |
TESTS |
74 |
155 |
31027200 |
|
2500 |
205411841 |
bearyuc |
C |
May 11, 2023, 9:45 a.m. |
OK |
GNU C++17 (64) |
TESTS |
75 |
155 |
31232000 |
|
2500 |
205229469 |
TheLostCookie |
C |
May 9, 2023, 1:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
75 |
155 |
34508800 |
|
2500 |
205109937 |
K-H |
C |
May 8, 2023, 1:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
72 |
155 |
36044800 |
|
2500 |
205380967 |
ytdnf |
C |
May 11, 2023, 1:53 a.m. |
OK |
GNU C++17 (64) |
TESTS |
75 |
156 |
40857600 |
|
2500 |
206420044 |
xjrjyy |
C |
May 19, 2023, 8:12 a.m. |
OK |
GNU C++17 (64) |
TESTS |
78 |
156 |
43622400 |
|
2500 |
205485819 |
idoproblems |
C |
May 12, 2023, 12:21 a.m. |
OK |
GNU C++17 (64) |
TESTS |
78 |
170 |
33689600 |
|
2500 |
205281626 |
Alex_Wei |
C |
May 10, 2023, 2:36 a.m. |
OK |
GNU C++17 (64) |
TESTS |
75 |
171 |
32665600 |
|
2500 |
205220259 |
Rainybunny |
C |
May 9, 2023, 12:03 p.m. |
OK |
GNU C++20 (64) |
TESTS |
75 |
109 |
28979200 |
|
2500 |
205194279 |
dimss |
C |
May 9, 2023, 7:27 a.m. |
OK |
GNU C++20 (64) |
TESTS |
74 |
109 |
30003200 |
|
2500 |
205290873 |
becaido |
C |
May 10, 2023, 5:36 a.m. |
OK |
GNU C++20 (64) |
TESTS |
75 |
124 |
27238400 |
|
2500 |
205240439 |
downpour |
C |
May 9, 2023, 2:56 p.m. |
OK |
GNU C++20 (64) |
TESTS |
75 |
124 |
27648000 |
|
2500 |
205136270 |
JavierN |
C |
May 8, 2023, 3:27 p.m. |
OK |
GNU C++20 (64) |
TESTS |
74 |
124 |
31232000 |
|
2500 |
205135620 |
JavierN |
C |
May 8, 2023, 3:22 p.m. |
OK |
GNU C++20 (64) |
TESTS |
74 |
124 |
31232000 |
|
2500 |
205202923 |
Nero |
C |
May 9, 2023, 9:11 a.m. |
OK |
GNU C++20 (64) |
TESTS |
75 |
124 |
37990400 |
|
2500 |
205144692 |
camc |
C |
May 8, 2023, 4:40 p.m. |
OK |
GNU C++20 (64) |
TESTS |
74 |
124 |
40448000 |
|
2500 |
205128397 |
mahdi.hasnat |
C |
May 8, 2023, 2:35 p.m. |
OK |
GNU C++20 (64) |
TESTS |
72 |
124 |
40448000 |
|
2500 |
205326883 |
threethreetwothree |
C |
May 10, 2023, 12:36 p.m. |
OK |
GNU C++20 (64) |
TESTS |
75 |
124 |
42086400 |
|
2500 |
205185836 |
0x3F |
C |
May 9, 2023, 5:25 a.m. |
OK |
Go |
TESTS |
74 |
249 |
77414400 |
|
2500 |
205185867 |
0x3F |
C |
May 9, 2023, 5:26 a.m. |
OK |
Go |
TESTS |
74 |
264 |
77414400 |
|
2500 |
205282718 |
kamranm |
C |
May 10, 2023, 3:04 a.m. |
OK |
Java 17 |
TESTS |
75 |
530 |
251084800 |
|
2500 |
205201839 |
zhouzelin |
C |
May 9, 2023, 8:59 a.m. |
OK |
Java 8 |
TESTS |
75 |
530 |
75468800 |
|
2500 |
205118700 |
top73only |
C |
May 8, 2023, 1:51 p.m. |
OK |
Kotlin 1.6 |
TESTS |
72 |
607 |
39731200 |
|
2500 |
205904790 |
Andrei_Kuz |
C |
May 14, 2023, 5:21 p.m. |
OK |
Kotlin 1.6 |
TESTS |
78 |
686 |
140902400 |
|
2500 |
205904889 |
Andrei_Kuz |
C |
May 14, 2023, 5:22 p.m. |
OK |
Kotlin 1.6 |
TESTS |
78 |
701 |
96051200 |
|
2500 |
205111702 |
Tlatoani |
C |
May 8, 2023, 1:28 p.m. |
OK |
Kotlin 1.7 |
TESTS |
72 |
1965 |
162508800 |
|
2500 |
205275842 |
hxu10 |
C |
May 9, 2023, 11:15 p.m. |
OK |
PyPy 3 |
TESTS |
75 |
529 |
44134400 |
|
2500 |
205275531 |
hxu10 |
C |
May 9, 2023, 11:05 p.m. |
OK |
PyPy 3-64 |
TESTS |
75 |
529 |
78745600 |
|
2500 |
205351859 |
bronze_coder |
C |
May 10, 2023, 4:34 p.m. |
OK |
PyPy 3-64 |
TESTS |
75 |
545 |
62054400 |
|
2500 |
205250469 |
Spheniscine |
C |
May 9, 2023, 4:25 p.m. |
OK |
Rust 2021 |
TESTS |
75 |
93 |
29900800 |
|
2500 |
205249531 |
Spheniscine |
C |
May 9, 2023, 4:16 p.m. |
OK |
Rust 2021 |
TESTS |
75 |
93 |
29900800 |
|
2500 |
205250254 |
Spheniscine |
C |
May 9, 2023, 4:23 p.m. |
OK |
Rust 2021 |
TESTS |
75 |
109 |
29900800 |
|
2500 |
206188159 |
robostac |
C |
May 17, 2023, 8:56 a.m. |
OK |
Rust 2021 |
TESTS |
78 |
109 |
66764800 |
|
2500 |
206187585 |
robostac |
C |
May 17, 2023, 8:50 a.m. |
OK |
Rust 2021 |
TESTS |
78 |
109 |
66764800 |
|
2500 |
205128612 |
sansen |
C |
May 8, 2023, 2:35 p.m. |
OK |
Rust 2021 |
TESTS |
72 |
140 |
23040000 |
|
2500 |
205378679 |
kost |
C |
May 11, 2023, 12:46 a.m. |
OK |
Rust 2021 |
TESTS |
75 |
140 |
69017600 |
|
2500 |
205824249 |
DmitryLzr |
C |
May 14, 2023, 11:07 a.m. |
OK |
Rust 2021 |
TESTS |
78 |
171 |
52531200 |
|
2500 |
205128407 |
sansen |
C |
May 8, 2023, 2:35 p.m. |
OK |
Rust 2021 |
TESTS |
72 |
1044 |
23142400 |
|
2500 |
remove filters
Back to search problems