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 node of the tree with index 1 and with weight 0. Let cnt be the number of nodes in the tree at any instant (initially, cnt is set to 1). Support Q queries of following two types: The tree is rooted at node 1 at any instant. Note that the queries are given in a modified way. First line containing the number of queries Q (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89Q xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89400000). Let last be the answer for previous query of type 2 (initially last equals 0). Each of the next Q lines contains a query of following form: denotes bitwise XOR of a and b. It is guaranteed that at least one query of type 2 exists. Output the answer to each query of second type in separate line. In the first example, last xe2 x80 x89= xe2 x80 x890 - Query 1: 1 1 1, Node 2 with weight 1 is added to node 1. - Query 2: 2 2 0, No sequence of nodes starting at 2 has weight less than or equal to 0. last xe2 x80 x89= xe2 x80 x890 - Query 3: 2 2 1, Answer is 1 as sequence will be {2}. last xe2 x80 x89= xe2 x80 x891 - Query 4: 1 2 1, Node 3 with weight 1 is added to node 2. - Query 5: 2 3 1, Answer is 1 as sequence will be {3}. Node 2 cannot be added as sum of weights cannot be greater than 1. last xe2 x80 x89= xe2 x80 x891 - Query 6: 2 3 3, Answer is 2 as sequence will be {3, xe2 x80 x892}. last xe2 x80 x89= xe2 x80 x892 '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
35328956 |
sweet_love |
D |
Feb. 16, 2018, 6:56 a.m. |
OK |
GNU C++ |
TESTS |
179 |
202 |
42291200 |
|
2200 |
35330563 |
vjudge5 |
D |
Feb. 16, 2018, 8:20 a.m. |
OK |
GNU C++ |
TESTS |
179 |
233 |
103219200 |
|
2200 |
35309959 |
zhouzhendong |
D |
Feb. 15, 2018, 3:48 p.m. |
OK |
GNU C++ |
TESTS |
179 |
249 |
41984000 |
|
2200 |
40424132 |
redbag |
D |
July 16, 2018, 3:04 p.m. |
OK |
GNU C++ |
TESTS |
179 |
264 |
94822400 |
|
2200 |
35340900 |
AutumnKite |
D |
Feb. 16, 2018, 2:41 p.m. |
OK |
GNU C++ |
TESTS |
179 |
265 |
125337600 |
|
2200 |
35312495 |
bestFy |
D |
Feb. 15, 2018, 4:10 p.m. |
OK |
GNU C++ |
TESTS |
179 |
280 |
91852800 |
|
2200 |
35385884 |
CenariusYZ |
D |
Feb. 17, 2018, 8:28 a.m. |
OK |
GNU C++ |
TESTS |
179 |
280 |
143667200 |
|
2200 |
35310970 |
rainy_season |
D |
Feb. 15, 2018, 3:57 p.m. |
OK |
GNU C++ |
TESTS |
179 |
280 |
151142400 |
|
2200 |
35328674 |
Anque |
D |
Feb. 16, 2018, 6:40 a.m. |
OK |
GNU C++ |
TESTS |
179 |
295 |
101580800 |
|
2200 |
35324341 |
yybyyb |
D |
Feb. 16, 2018, 1:41 a.m. |
OK |
GNU C++ |
TESTS |
179 |
295 |
318771200 |
|
2200 |
53100880 |
rainboy |
D |
April 21, 2019, 4:23 p.m. |
OK |
GNU C11 |
TESTS |
179 |
1465 |
96153600 |
|
2200 |
35448020 |
Georgia_001 |
D |
Feb. 18, 2018, 2:08 p.m. |
OK |
GNU C++11 |
TESTS |
179 |
171 |
42188800 |
|
2200 |
35317345 |
atatomir |
D |
Feb. 15, 2018, 6:43 p.m. |
OK |
GNU C++11 |
TESTS |
179 |
171 |
43212800 |
|
2200 |
48953011 |
vjudge4 |
D |
Jan. 26, 2019, 1:59 a.m. |
OK |
GNU C++11 |
TESTS |
179 |
187 |
100966400 |
|
2200 |
40978179 |
ReaLNero1 |
D |
July 30, 2018, 4:30 p.m. |
OK |
GNU C++11 |
TESTS |
179 |
202 |
41164800 |
|
2200 |
35317818 |
nonsequitur |
D |
Feb. 15, 2018, 6:53 p.m. |
OK |
GNU C++11 |
TESTS |
179 |
202 |
96665600 |
|
2200 |
51332189 |
KING_LRL |
D |
March 15, 2019, 12:36 p.m. |
OK |
GNU C++11 |
TESTS |
179 |
217 |
128307200 |
|
2200 |
51332755 |
Duanyll |
D |
March 15, 2019, 12:48 p.m. |
OK |
GNU C++11 |
TESTS |
179 |
217 |
136294400 |
|
2200 |
44524077 |
LJZ_C |
D |
Oct. 18, 2018, 11:50 p.m. |
OK |
GNU C++11 |
TESTS |
179 |
218 |
99430400 |
|
2200 |
44524173 |
vjudge1 |
D |
Oct. 19, 2018, midnight |
OK |
GNU C++11 |
TESTS |
179 |
233 |
99430400 |
|
2200 |
51332799 |
vjudge1 |
D |
March 15, 2019, 12:49 p.m. |
OK |
GNU C++11 |
TESTS |
179 |
233 |
136294400 |
|
2200 |
35318846 |
fanache99 |
D |
Feb. 15, 2018, 7:25 p.m. |
OK |
GNU C++14 |
TESTS |
179 |
202 |
157491200 |
|
2200 |
66385028 |
davidberard |
D |
Dec. 6, 2019, 7:11 a.m. |
OK |
GNU C++14 |
TESTS |
179 |
248 |
126873600 |
|
2200 |
39276102 |
lionadis |
D |
June 15, 2018, 11:05 p.m. |
OK |
GNU C++14 |
TESTS |
179 |
265 |
125235200 |
|
2200 |
41919568 |
handsomek |
D |
Aug. 21, 2018, 2:39 a.m. |
OK |
GNU C++14 |
TESTS |
179 |
312 |
195686400 |
|
2200 |
52230124 |
vjudge1 |
D |
April 2, 2019, 11:34 a.m. |
OK |
GNU C++14 |
TESTS |
179 |
373 |
40038400 |
|
2200 |
52225352 |
vjudge1 |
D |
April 2, 2019, 9:06 a.m. |
OK |
GNU C++14 |
TESTS |
179 |
373 |
54476800 |
|
2200 |
52230159 |
vjudge1 |
D |
April 2, 2019, 11:35 a.m. |
OK |
GNU C++14 |
TESTS |
179 |
374 |
40038400 |
|
2200 |
52228187 |
vjudge5 |
D |
April 2, 2019, 10:43 a.m. |
OK |
GNU C++14 |
TESTS |
179 |
374 |
41676800 |
|
2200 |
35321978 |
Jester |
D |
Feb. 15, 2018, 9:51 p.m. |
OK |
GNU C++14 |
TESTS |
179 |
390 |
41984000 |
|
2200 |
49915368 |
n_dao107 |
D |
Feb. 14, 2019, 4:13 p.m. |
OK |
GNU C++14 |
TESTS |
179 |
390 |
99430400 |
|
2200 |
40977725 |
ReaLNero1 |
D |
July 30, 2018, 4:19 p.m. |
OK |
GNU C++17 |
TESTS |
179 |
171 |
41164800 |
|
2200 |
52229100 |
vjudge1 |
D |
April 2, 2019, 11:08 a.m. |
OK |
GNU C++17 |
TESTS |
179 |
358 |
40038400 |
|
2200 |
52155700 |
vjudge2 |
D |
April 1, 2019, 1:20 p.m. |
OK |
GNU C++17 |
TESTS |
179 |
358 |
40140800 |
|
2200 |
52155798 |
vjudge5 |
D |
April 1, 2019, 1:22 p.m. |
OK |
GNU C++17 |
TESTS |
179 |
358 |
40140800 |
|
2200 |
55963992 |
lajiyuan |
D |
June 23, 2019, 11:02 a.m. |
OK |
GNU C++17 |
TESTS |
179 |
358 |
248524800 |
|
2200 |
42260684 |
JacaJava |
D |
Aug. 30, 2018, 2:54 a.m. |
OK |
GNU C++17 |
TESTS |
179 |
373 |
185139200 |
|
2200 |
52231799 |
vjudge5 |
D |
April 2, 2019, 12:10 p.m. |
OK |
GNU C++17 |
TESTS |
179 |
374 |
40038400 |
|
2200 |
52156619 |
vjudge3 |
D |
April 1, 2019, 1:39 p.m. |
OK |
GNU C++17 |
TESTS |
179 |
374 |
40140800 |
|
2200 |
52217936 |
vjudge2 |
D |
April 2, 2019, 4:09 a.m. |
OK |
GNU C++17 |
TESTS |
179 |
389 |
41676800 |
|
2200 |
52155415 |
vjudge5 |
D |
April 1, 2019, 1:14 p.m. |
OK |
GNU C++17 |
TESTS |
179 |
404 |
73728000 |
|
2200 |
35311686 |
uwi |
D |
Feb. 15, 2018, 4:03 p.m. |
OK |
Java 8 |
TESTS |
179 |
405 |
135680000 |
|
2200 |
35823116 |
Ahmad |
D |
March 2, 2018, 1:52 a.m. |
OK |
Java 8 |
TESTS |
179 |
498 |
213913600 |
|
2200 |
36559377 |
BiIIy |
D |
March 24, 2018, 1:25 a.m. |
OK |
Java 8 |
TESTS |
179 |
530 |
381542400 |
|
2200 |
53095839 |
supriya14 |
D |
April 21, 2019, 1:29 p.m. |
OK |
Java 8 |
TESTS |
179 |
545 |
204185600 |
|
2200 |
35312612 |
Azat_Yusupov |
D |
Feb. 15, 2018, 4:11 p.m. |
OK |
Java 8 |
TESTS |
179 |
561 |
81203200 |
|
2200 |
35318020 |
fnch |
D |
Feb. 15, 2018, 6:58 p.m. |
OK |
Java 8 |
TESTS |
179 |
592 |
87859200 |
|
2200 |
35823089 |
Ahmad |
D |
March 2, 2018, 1:49 a.m. |
OK |
Java 8 |
TESTS |
179 |
592 |
361676800 |
|
2200 |
35596875 |
Taran_1407 |
D |
Feb. 23, 2018, 12:54 p.m. |
OK |
Java 8 |
TESTS |
179 |
608 |
227020800 |
|
2200 |
35312411 |
Omar_Morsi |
D |
Feb. 15, 2018, 4:09 p.m. |
OK |
Java 8 |
TESTS |
179 |
623 |
228966400 |
|
2200 |
35320234 |
guptautkarsh028 |
D |
Feb. 15, 2018, 8:17 p.m. |
OK |
Java 8 |
TESTS |
179 |
639 |
154419200 |
|
2200 |
38076825 |
og.kostya |
D |
May 9, 2018, 4:15 p.m. |
OK |
Mono C# |
TESTS |
179 |
780 |
160256000 |
|
2200 |
38076695 |
og.kostya |
D |
May 9, 2018, 4:08 p.m. |
OK |
Mono C# |
TESTS |
179 |
795 |
163840000 |
|
2200 |
57183538 |
vjudge1 |
D |
July 17, 2019, 8:01 a.m. |
OK |
MS C++ |
TESTS |
179 |
295 |
40140800 |
|
2200 |
57183619 |
vjudge4 |
D |
July 17, 2019, 8:02 a.m. |
OK |
MS C++ |
TESTS |
179 |
327 |
40038400 |
|
2200 |
35327149 |
x0000ai |
D |
Feb. 16, 2018, 5:22 a.m. |
OK |
MS C++ |
TESTS |
179 |
343 |
43724800 |
|
2200 |
51251427 |
vjudge2 |
D |
March 13, 2019, 8:55 a.m. |
OK |
MS C++ |
TESTS |
179 |
358 |
109056000 |
|
2200 |
44472683 |
vjudge4 |
D |
Oct. 18, 2018, 7:11 a.m. |
OK |
MS C++ |
TESTS |
179 |
374 |
131788800 |
|
2200 |
35340481 |
yp0416160202 |
D |
Feb. 16, 2018, 2:28 p.m. |
OK |
MS C++ |
TESTS |
179 |
389 |
133529600 |
|
2200 |
35304253 |
RAVEman |
D |
Feb. 15, 2018, 3:09 p.m. |
OK |
MS C++ |
TESTS |
179 |
390 |
107110400 |
|
2200 |
57218599 |
vjudge2 |
D |
July 17, 2019, 3:17 p.m. |
OK |
MS C++ |
TESTS |
179 |
405 |
137932800 |
|
2200 |
35313834 |
Erop |
D |
Feb. 15, 2018, 4:22 p.m. |
OK |
MS C++ |
TESTS |
179 |
405 |
166400000 |
|
2200 |
35317521 |
miha715lev |
D |
Feb. 15, 2018, 6:47 p.m. |
OK |
MS C++ |
TESTS |
179 |
421 |
94208000 |
|
2200 |
remove filters
Back to search problems