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'Abendsen assigned a mission to Juliana. In this mission, Juliana has a rooted tree with n vertices. Vertex number 1 is the root of this tree. Each vertex can be either black or white. At first, all vertices are white. Juliana is asked to process q queries. Each query is one of three types: Can you help Juliana to process all these queries? The first line contains two integers n and q ( 2 <= q n <= q 10^5 , 1 <= q q <= q 10^5 ) -- the number of vertices and the number of queries. The second line contains n-1 integers p_2, p_3, ldots, p_n ( 1 <= q p_i<i ), where p_i means that there is an edge between vertices i and p_i . Each of the next q lines contains two integers t_i and v_i ( 1 <= q t_i <= q 3 , 1 <= q v_i <= q n ) -- the type of the i -th query and the vertex of the i -th query. It is guaranteed that the given graph is a tree. For each query of type 3 , print "black" if the vertex is black; otherwise, print "white". The first example is shown on the picture below. The second example is shown on the picture below. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
41537302 |
test616.cpp |
G |
Aug. 12, 2018, 6:47 p.m. |
OK |
GNU C++ |
TESTS |
36 |
171 |
15257600 |
|
3200 |
41391000 |
vjudge4 |
G |
Aug. 9, 2018, 8:26 a.m. |
OK |
GNU C++ |
TESTS |
36 |
171 |
17203200 |
|
3200 |
41385433 |
test616.cpp |
G |
Aug. 9, 2018, 5:31 a.m. |
OK |
GNU C++ |
TESTS |
36 |
187 |
16281600 |
|
3200 |
41416236 |
samjia2000 |
G |
Aug. 10, 2018, 3:02 a.m. |
OK |
GNU C++ |
TESTS |
36 |
265 |
11161600 |
|
3200 |
41616326 |
luogu_bot1 |
G |
Aug. 15, 2018, 9:22 a.m. |
OK |
GNU C++ |
TESTS |
36 |
296 |
17203200 |
|
3200 |
41401090 |
SylvanasS |
G |
Aug. 9, 2018, 1:42 p.m. |
OK |
GNU C++ |
TESTS |
36 |
405 |
12390400 |
|
3200 |
42452470 |
_rockdu |
G |
Sept. 4, 2018, 9:04 a.m. |
OK |
GNU C++ |
TESTS |
36 |
1279 |
8806400 |
|
3200 |
42027635 |
vjudge4 |
G |
Aug. 24, 2018, 1:27 p.m. |
OK |
GNU C++ |
TESTS |
36 |
2277 |
17408000 |
|
3200 |
42028948 |
vjudge5 |
G |
Aug. 24, 2018, 2:19 p.m. |
OK |
GNU C++ |
TESTS |
36 |
2994 |
14438400 |
|
3200 |
64699768 |
luogu_bot4 |
G |
Nov. 11, 2019, 2:27 p.m. |
OK |
GNU C++11 |
TESTS |
36 |
124 |
16384000 |
|
3200 |
64678352 |
_ppp204 |
G |
Nov. 11, 2019, 8:58 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
124 |
16384000 |
|
3200 |
46923198 |
supper |
G |
Dec. 12, 2018, 6:43 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
124 |
19660800 |
|
3200 |
64677284 |
_ppp204 |
G |
Nov. 11, 2019, 8:33 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
124 |
20480000 |
|
3200 |
43163781 |
Isrothy |
G |
Sept. 21, 2018, 3:26 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
124 |
132915200 |
|
3200 |
49688138 |
Houston-Rockets |
G |
Feb. 10, 2019, 9:12 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
139 |
12390400 |
|
3200 |
46959452 |
fwat |
G |
Dec. 13, 2018, 7:05 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
139 |
12800000 |
|
3200 |
64682853 |
Mr_RLB |
G |
Nov. 11, 2019, 10:44 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
139 |
13721600 |
|
3200 |
64678316 |
_ppp204 |
G |
Nov. 11, 2019, 8:58 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
139 |
16384000 |
|
3200 |
46962489 |
luogu_bot2 |
G |
Dec. 13, 2018, 9:09 a.m. |
OK |
GNU C++11 |
TESTS |
36 |
139 |
16384000 |
|
3200 |
46652505 |
tender_green |
G |
Dec. 5, 2018, 2:41 p.m. |
OK |
GNU C++14 |
TESTS |
36 |
140 |
17408000 |
|
3200 |
63288604 |
jakedavis |
G |
Oct. 24, 2019, 11:07 a.m. |
OK |
GNU C++14 |
TESTS |
36 |
155 |
10752000 |
|
3200 |
54747875 |
lyx_cjz |
G |
May 28, 2019, 11:28 a.m. |
OK |
GNU C++14 |
TESTS |
36 |
156 |
14950400 |
|
3200 |
46676017 |
tender_green |
G |
Dec. 6, 2018, 9:47 a.m. |
OK |
GNU C++14 |
TESTS |
36 |
171 |
17408000 |
|
3200 |
41448553 |
Combi |
G |
Aug. 11, 2018, 2:16 a.m. |
OK |
GNU C++14 |
TESTS |
36 |
186 |
15769600 |
|
3200 |
41370631 |
consecutivelimit |
G |
Aug. 8, 2018, 5:34 p.m. |
OK |
GNU C++14 |
TESTS |
36 |
202 |
9932800 |
|
3200 |
43112385 |
Solashiro |
G |
Sept. 20, 2018, 12:16 p.m. |
OK |
GNU C++14 |
TESTS |
36 |
202 |
14438400 |
|
3200 |
41375028 |
teapotd |
G |
Aug. 8, 2018, 7:59 p.m. |
OK |
GNU C++14 |
TESTS |
36 |
202 |
16691200 |
|
3200 |
43942639 |
superguymj |
G |
Oct. 7, 2018, 12:11 p.m. |
OK |
GNU C++14 |
TESTS |
36 |
217 |
12800000 |
|
3200 |
44018774 |
JioFell |
G |
Oct. 9, 2018, 1:26 a.m. |
OK |
GNU C++14 |
TESTS |
36 |
217 |
15769600 |
|
3200 |
47506652 |
yangjinhao |
G |
Dec. 26, 2018, 1:22 a.m. |
OK |
GNU C++17 |
TESTS |
36 |
171 |
17203200 |
|
3200 |
64697978 |
Zxzz106 |
G |
Nov. 11, 2019, 1:55 p.m. |
OK |
GNU C++17 |
TESTS |
36 |
171 |
18227200 |
|
3200 |
47806028 |
iotang |
G |
Jan. 1, 2019, 7:18 a.m. |
OK |
GNU C++17 |
TESTS |
36 |
171 |
24780800 |
|
3200 |
41370547 |
LiChenKoh |
G |
Aug. 8, 2018, 5:33 p.m. |
OK |
GNU C++17 |
TESTS |
36 |
171 |
29184000 |
|
3200 |
68073641 |
HyscereXD |
G |
Jan. 2, 2020, 11:32 a.m. |
OK |
GNU C++17 |
TESTS |
36 |
186 |
13619200 |
|
3200 |
43111880 |
CalvinJin |
G |
Sept. 20, 2018, 12:04 p.m. |
OK |
GNU C++17 |
TESTS |
36 |
186 |
15462400 |
|
3200 |
41737314 |
Roundgod |
G |
Aug. 18, 2018, 3:14 a.m. |
OK |
GNU C++17 |
TESTS |
36 |
187 |
25804800 |
|
3200 |
41431096 |
Himadri-nath |
G |
Aug. 10, 2018, 12:37 p.m. |
OK |
GNU C++17 |
TESTS |
36 |
202 |
5120000 |
|
3200 |
43987192 |
TargetLocked |
G |
Oct. 8, 2018, 8:01 a.m. |
OK |
GNU C++17 |
TESTS |
36 |
202 |
12288000 |
|
3200 |
43114532 |
Zerokei |
G |
Sept. 20, 2018, 1:08 p.m. |
OK |
GNU C++17 |
TESTS |
36 |
202 |
15564800 |
|
3200 |
41444348 |
tri |
G |
Aug. 10, 2018, 9:25 p.m. |
OK |
Java 8 |
TESTS |
36 |
670 |
38912000 |
|
3200 |
41444314 |
tri |
G |
Aug. 10, 2018, 9:23 p.m. |
OK |
Java 8 |
TESTS |
36 |
2776 |
38912000 |
|
3200 |
46676438 |
vjudge4 |
G |
Dec. 6, 2018, 10:01 a.m. |
OK |
MS C++ |
TESTS |
36 |
202 |
13619200 |
|
3200 |
46675075 |
vjudge2 |
G |
Dec. 6, 2018, 9:17 a.m. |
OK |
MS C++ |
TESTS |
36 |
249 |
13619200 |
|
3200 |
remove filters
Back to search problems