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.
ContestId |
Name |
Phase |
Frozen |
Duration (Seconds) |
Relative Time |
Start Time |
1055
|
Mail.Ru Cup 2018 Round 2 |
FINISHED |
False |
9000 |
195665123 |
Nov. 10, 2018, 2:35 p.m. |
Problems
B'You are given a connected undirected graph without cycles (that is, a tree) of n vertices, moreover, there is a non-negative integer written on every edge. Consider all pairs of vertices (v, u) (that is, there are exactly n^2 such pairs) and for each pair calculate the bitwise exclusive or (xor) of all integers on edges of the simple path between v and u . If the path consists of one vertex only, then xor of all integers on edges of this path is equal to 0 . Suppose we sorted the resulting n^2 values in non-decreasing order. You need to find the k -th of them. The definition of xor is as follows. Given two integers x and y , consider their binary representations (possibly with leading zeros): x_k ... x_2 x_1 x_0 and y_k ... y_2 y_1 y_0 (where k is any number so that all bits of x and y can be represented). Here, x_i is the i -th bit of the number x and y_i is the i -th bit of the number y . Let r = x oplus y be the result of the xor operation of x and y . Then r is defined as r_k ... r_2 r_1 r_0 where: r_i = <= ft { begin{aligned} 1, ~ text{if} ~ x_i ne y_i 0, ~ text{if} ~ x_i = y_i end{aligned} right. The first line contains two integers n and k ( 2 <= n <= 10^6 , 1 <= k <= n^2 ) -- the number of vertices in the tree and the number of path in the list with non-decreasing order. Each of the following n - 1 lines contains two integers p_i and w_i ( 1 <= p_i <= i , 0 <= w_i < 2^{62} ) -- the ancestor of vertex i + 1 and the weight of the corresponding edge. Print one integer: k -th smallest xor of a path in the tree. The tree in the second sample test looks like this: For such a tree in total 9 paths exist: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
66480840 |
dblark |
F |
Dec. 8, 2019, 2:20 a.m. |
OK |
FPC |
TESTS |
67 |
2745 |
28057600 |
|
2800 |
46205777 |
krijgertje |
F |
Nov. 25, 2018, 2:12 p.m. |
OK |
GNU C++11 |
TESTS |
67 |
873 |
68096000 |
|
2800 |
54410918 |
SoiMae |
F |
May 20, 2019, 9:40 a.m. |
OK |
GNU C++11 |
TESTS |
67 |
966 |
53964800 |
|
2800 |
45592812 |
Panole233 |
F |
Nov. 12, 2018, 1:34 p.m. |
OK |
GNU C++11 |
TESTS |
67 |
982 |
23859200 |
|
2800 |
45661603 |
dy0607 |
F |
Nov. 13, 2018, 6:57 a.m. |
OK |
GNU C++11 |
TESTS |
67 |
982 |
72192000 |
|
2800 |
45580304 |
function348 |
F |
Nov. 12, 2018, 3:26 a.m. |
OK |
GNU C++11 |
TESTS |
67 |
1060 |
20070400 |
|
2800 |
69929408 |
duality |
F |
Jan. 31, 2020, 10:28 p.m. |
OK |
GNU C++11 |
TESTS |
67 |
1076 |
41984000 |
|
2800 |
45653188 |
cuizhuyefei |
F |
Nov. 13, 2018, 3:50 a.m. |
OK |
GNU C++11 |
TESTS |
67 |
1076 |
193536000 |
|
2800 |
49922923 |
nickjohn |
F |
Feb. 14, 2019, 8:05 p.m. |
OK |
GNU C++11 |
TESTS |
67 |
1153 |
24064000 |
|
2800 |
53042253 |
Ogiso |
F |
April 20, 2019, 10:30 a.m. |
OK |
GNU C++11 |
TESTS |
67 |
1169 |
101068800 |
|
2800 |
45670047 |
gyz_gyz |
F |
Nov. 13, 2018, 10:01 a.m. |
OK |
GNU C++11 |
TESTS |
67 |
1263 |
48128000 |
|
2800 |
50257210 |
Jester |
F |
Feb. 20, 2019, 8:26 p.m. |
OK |
GNU C++14 |
TESTS |
67 |
1107 |
56115200 |
|
2800 |
46389976 |
Marckess |
F |
Nov. 30, 2018, 4:55 a.m. |
OK |
GNU C++14 |
TESTS |
67 |
1138 |
76185600 |
|
2800 |
46389975 |
Marckess |
F |
Nov. 30, 2018, 4:55 a.m. |
OK |
GNU C++14 |
TESTS |
67 |
1154 |
76185600 |
|
2800 |
45648244 |
Suzukaze |
F |
Nov. 12, 2018, 9:14 p.m. |
OK |
GNU C++14 |
TESTS |
67 |
1185 |
48128000 |
|
2800 |
45670085 |
yfzcsc |
F |
Nov. 13, 2018, 10:03 a.m. |
OK |
GNU C++14 |
TESTS |
67 |
1185 |
56115200 |
|
2800 |
45701956 |
Quang |
F |
Nov. 14, 2018, 9:02 a.m. |
OK |
GNU C++14 |
TESTS |
67 |
1216 |
48128000 |
|
2800 |
45546919 |
icube |
F |
Nov. 11, 2018, 2:45 a.m. |
OK |
GNU C++14 |
TESTS |
67 |
1263 |
82841600 |
|
2800 |
46352810 |
neal |
F |
Nov. 29, 2018, 6:26 a.m. |
OK |
GNU C++14 |
TESTS |
67 |
1356 |
32153600 |
|
2800 |
45767780 |
xdu_lhz |
F |
Nov. 15, 2018, 1:01 p.m. |
OK |
GNU C++14 |
TESTS |
67 |
1372 |
28057600 |
|
2800 |
50257248 |
Jester |
F |
Feb. 20, 2019, 8:27 p.m. |
OK |
GNU C++14 |
TESTS |
67 |
1450 |
49561600 |
|
2800 |
65431563 |
A_Fan_of_the_AK_King--lk |
F |
Nov. 20, 2019, 12:13 p.m. |
OK |
GNU C++17 |
TESTS |
67 |
1247 |
80179200 |
|
2800 |
45549829 |
hiThere23 |
F |
Nov. 11, 2018, 4:03 a.m. |
OK |
GNU C++17 |
TESTS |
67 |
1372 |
30003200 |
|
2800 |
45526253 |
LHiC |
F |
Nov. 10, 2018, 3:38 p.m. |
OK |
GNU C++17 |
TESTS |
67 |
1450 |
66252800 |
|
2800 |
46282229 |
RedTea |
F |
Nov. 27, 2018, 1:58 p.m. |
OK |
GNU C++17 |
TESTS |
67 |
1543 |
61030400 |
|
2800 |
46282173 |
RedTea |
F |
Nov. 27, 2018, 1:56 p.m. |
OK |
GNU C++17 |
TESTS |
67 |
1621 |
61030400 |
|
2800 |
45539778 |
mareksom |
F |
Nov. 10, 2018, 6:44 p.m. |
OK |
GNU C++17 |
TESTS |
67 |
1622 |
120729600 |
|
2800 |
45541333 |
teapotd |
F |
Nov. 10, 2018, 7:37 p.m. |
OK |
GNU C++17 |
TESTS |
67 |
1637 |
50073600 |
|
2800 |
66728155 |
saketh |
F |
Dec. 12, 2019, 4:39 p.m. |
OK |
GNU C++17 |
TESTS |
67 |
1638 |
36044800 |
|
2800 |
45695614 |
Benq |
F |
Nov. 14, 2018, 2:54 a.m. |
OK |
GNU C++17 |
TESTS |
67 |
1638 |
58777600 |
|
2800 |
45534417 |
Fedosik |
F |
Nov. 10, 2018, 4:41 p.m. |
OK |
GNU C++17 |
TESTS |
67 |
1684 |
49561600 |
|
2800 |
45749916 |
savinov |
F |
Nov. 14, 2018, 11:32 p.m. |
OK |
Go |
TESTS |
67 |
3696 |
27648000 |
|
2800 |
45749893 |
savinov |
F |
Nov. 14, 2018, 11:29 p.m. |
OK |
Go |
TESTS |
67 |
3712 |
27648000 |
|
2800 |
45528177 |
eatmore |
F |
Nov. 10, 2018, 3:51 p.m. |
OK |
Java 8 |
TESTS |
67 |
1887 |
22425600 |
|
2800 |
45535228 |
qwerty787788 |
F |
Nov. 10, 2018, 4:48 p.m. |
OK |
Java 8 |
TESTS |
67 |
1918 |
135372800 |
|
2800 |
45534599 |
Petr |
F |
Nov. 10, 2018, 4:43 p.m. |
OK |
Java 8 |
TESTS |
67 |
2168 |
39116800 |
|
2800 |
46399101 |
x1ziz |
F |
Nov. 30, 2018, 11:22 a.m. |
OK |
Java 8 |
TESTS |
67 |
2183 |
39116800 |
|
2800 |
68101567 |
dalt |
F |
Jan. 3, 2020, 3:37 a.m. |
OK |
Java 8 |
TESTS |
67 |
2822 |
105164800 |
|
2800 |
68101671 |
dalt |
F |
Jan. 3, 2020, 3:42 a.m. |
OK |
Java 8 |
TESTS |
67 |
2823 |
105164800 |
|
2800 |
68101394 |
dalt |
F |
Jan. 3, 2020, 3:24 a.m. |
OK |
Java 8 |
TESTS |
67 |
2932 |
105574400 |
|
2800 |
remove filters
Back to search problems