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'You are given a tree consisting of n vertices. There is an integer written on each vertex; the i -th vertex has integer a_i written on it. You have to process q queries. The i -th query consists of three integers x_i , y_i and k_i . For this query, you have to answer if it is possible to choose a set of vertices v_1, v_2, ... , v_m (possibly empty) such that: The first line contains one integer n ( 2 <= n <= 2 cdot 10^5 ). The second line contains n integers a_1, a_2, ... , a_n ( 0 <= a_i <= 2^{20} - 1 ). Then n-1 lines follow. Each of them contains two integers u and v ( 1 <= u, v <= n ; u ne v ) denoting an edge of the tree. The next line contains one integer q ( 1 <= q <= 2 cdot 10^5 ) -- the number of queries. Then q lines follow. The i -th of them contains three integers x_i , y_i and k_i ( 1 <= x_i, y_i <= n ; 0 <= k_i <= 2^{20} - 1 ). For each query, print YES if it is possible to form a set of vertices meeting the constraints. Otherwise, print NO. You can print each letter in any case. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
235642539 |
zhicheng |
F |
Dec. 4, 2023, 12:25 a.m. |
OK |
GNU C++14 |
TESTS |
81 |
826 |
108748800 |
|
|
235642433 |
songke123 |
F |
Dec. 4, 2023, 12:22 a.m. |
OK |
GNU C++14 |
TESTS |
81 |
982 |
96153600 |
|
|
235657486 |
StarSilk |
F |
Dec. 4, 2023, 5:07 a.m. |
OK |
GNU C++14 |
TESTS |
81 |
997 |
58163200 |
|
|
235642701 |
Smallbasic |
F |
Dec. 4, 2023, 12:29 a.m. |
OK |
GNU C++14 |
TESTS |
81 |
1575 |
330137600 |
|
|
235642712 |
nch123 |
F |
Dec. 4, 2023, 12:29 a.m. |
OK |
GNU C++14 |
TESTS |
81 |
2886 |
96460800 |
|
|
235601164 |
busamate |
F |
Dec. 3, 2023, 4:30 p.m. |
OK |
GNU C++14 |
TESTS |
81 |
3619 |
444313600 |
|
|
235603630 |
busamate |
F |
Dec. 3, 2023, 4:34 p.m. |
OK |
GNU C++14 |
TESTS |
81 |
3634 |
443289600 |
|
|
235660563 |
XHZS_XY |
F |
Dec. 4, 2023, 5:48 a.m. |
OK |
GNU C++14 |
TESTS |
82 |
3931 |
497971200 |
|
|
235655550 |
gty314159 |
F |
Dec. 4, 2023, 4:37 a.m. |
OK |
GNU C++14 |
TESTS |
81 |
4056 |
327577600 |
|
|
235601278 |
busamate |
F |
Dec. 3, 2023, 4:30 p.m. |
OK |
GNU C++14 |
TESTS |
81 |
4149 |
444313600 |
|
|
235612656 |
Meeena |
F |
Dec. 3, 2023, 5:23 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
764 |
43724800 |
|
|
235612413 |
Meeena |
F |
Dec. 3, 2023, 5:22 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
795 |
43724800 |
|
|
235608370 |
Shuishui_0921 |
F |
Dec. 3, 2023, 4:57 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
1918 |
122880000 |
|
|
235608225 |
patou |
F |
Dec. 3, 2023, 4:57 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
1996 |
318668800 |
|
|
235605336 |
2022haha |
F |
Dec. 3, 2023, 4:43 p.m. |
OK |
GNU C++17 |
TESTS |
81 |
2121 |
396595200 |
|
|
235653986 |
PeruvianCartel |
F |
Dec. 4, 2023, 4:10 a.m. |
OK |
GNU C++17 |
TESTS |
81 |
2558 |
422195200 |
|
|
235648003 |
Yseris |
F |
Dec. 4, 2023, 2:19 a.m. |
OK |
GNU C++17 |
TESTS |
81 |
3291 |
39116800 |
|
|
235642592 |
MadRat_2 |
F |
Dec. 4, 2023, 12:27 a.m. |
OK |
GNU C++17 |
TESTS |
81 |
3899 |
443187200 |
|
|
235642497 |
MadRat_0 |
F |
Dec. 4, 2023, 12:24 a.m. |
OK |
GNU C++17 |
TESTS |
81 |
3899 |
443187200 |
|
|
235655775 |
Swishy123 |
F |
Dec. 4, 2023, 4:41 a.m. |
OK |
GNU C++17 |
TESTS |
81 |
4196 |
379392000 |
|
|
235609974 |
rbegin |
F |
Dec. 3, 2023, 5:07 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
499 |
65024000 |
|
|
235618625 |
fyh20 |
F |
Dec. 3, 2023, 6:10 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
811 |
61440000 |
|
|
235650957 |
songke123 |
F |
Dec. 4, 2023, 3:16 a.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
888 |
94822400 |
|
|
235647498 |
Khozhaev |
F |
Dec. 4, 2023, 2:09 a.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
1450 |
74956800 |
|
|
235602060 |
lunchbox |
F |
Dec. 3, 2023, 4:31 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
1684 |
50892800 |
|
|
235604819 |
MarcosK |
F |
Dec. 3, 2023, 4:42 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
1840 |
450867200 |
|
|
235660300 |
cxm1024 |
F |
Dec. 4, 2023, 5:44 a.m. |
OK |
GNU C++17 (64) |
TESTS |
82 |
2152 |
117452800 |
|
|
235635331 |
-Fainted- |
F |
Dec. 3, 2023, 9:10 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
2589 |
71475200 |
|
|
235640975 |
enslaved |
F |
Dec. 3, 2023, 11:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
2838 |
92364800 |
|
|
235655933 |
alif_cse_ju |
F |
Dec. 4, 2023, 4:43 a.m. |
OK |
GNU C++17 (64) |
TESTS |
81 |
3775 |
353996800 |
|
|
235645751 |
User_Carrot |
F |
Dec. 4, 2023, 1:38 a.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
686 |
63078400 |
|
|
235608228 |
qwq7 |
F |
Dec. 3, 2023, 4:57 p.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
701 |
49766400 |
|
|
235646123 |
gabriel88766 |
F |
Dec. 4, 2023, 1:44 a.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
716 |
82944000 |
|
|
235628858 |
gabriel88766 |
F |
Dec. 3, 2023, 7:44 p.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
717 |
82944000 |
|
|
235661313 |
Leaf.Maple |
F |
Dec. 4, 2023, 5:57 a.m. |
OK |
GNU C++20 (64) |
TESTS |
83 |
748 |
127590400 |
|
|
235661185 |
dfsof |
F |
Dec. 4, 2023, 5:56 a.m. |
OK |
GNU C++20 (64) |
TESTS |
83 |
748 |
127590400 |
|
|
235651028 |
QedDust413 |
F |
Dec. 4, 2023, 3:17 a.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
794 |
69529600 |
|
|
235651462 |
Lazy.JPG |
F |
Dec. 4, 2023, 3:25 a.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
795 |
50790400 |
|
|
235651430 |
2qbingxuan |
F |
Dec. 4, 2023, 3:25 a.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
826 |
108646400 |
|
|
235638466 |
Boboge |
F |
Dec. 3, 2023, 10:28 p.m. |
OK |
GNU C++20 (64) |
TESTS |
81 |
842 |
71270400 |
|
|
235637276 |
TCchen |
F |
Dec. 3, 2023, 10:06 p.m. |
OK |
Java 17 |
TESTS |
81 |
1481 |
85094400 |
|
|
235601455 |
tabr |
F |
Dec. 3, 2023, 4:30 p.m. |
OK |
Kotlin 1.7 |
TESTS |
81 |
5912 |
477798400 |
|
|
235601272 |
tabr |
F |
Dec. 3, 2023, 4:30 p.m. |
OK |
Kotlin 1.7 |
TESTS |
81 |
6067 |
493260800 |
|
|
235603537 |
misorin |
F |
Dec. 3, 2023, 4:34 p.m. |
OK |
PyPy 3-64 |
TESTS |
81 |
5958 |
180940800 |
|
|
235599360 |
misorin |
F |
Dec. 3, 2023, 4:26 p.m. |
OK |
PyPy 3-64 |
TESTS |
81 |
5974 |
178176000 |
|
|
235641526 |
kost |
F |
Dec. 3, 2023, 11:58 p.m. |
OK |
Rust 2021 |
TESTS |
81 |
5365 |
95436800 |
|
|
remove filters
Back to search problems