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 |
1110
|
Codeforces Global Round 1 |
FINISHED |
False |
7200 |
187979123 |
Feb. 7, 2019, 1:35 p.m. |
Problems
B"Let's define the Eulerian traversal of a tree (a connected undirected graph without cycles) as follows: consider a depth-first search algorithm which traverses vertices of the tree and enumerates them in the order of visiting (only the first visit of each vertex counts). This function starts from the vertex number 1 and then recursively runs from all vertices which are connected with an edge with the current vertex and are not yet visited in increasing numbers order. Formally, you can describe this function using the following pseudocode: You are given a weighted tree, the vertices of which were enumerated with integers from 1 to n using the algorithm described above. A leaf is a vertex of the tree which is connected with only one other vertex. In the tree given to you, the vertex 1 is not a leaf. The distance between two vertices in the tree is the sum of weights of the edges on the simple path between them. You have to answer q queries of the following type: given integers v , l and r , find the shortest distance from vertex v to one of the leaves with indices from l to r inclusive. The first line contains two integers n and q ( 3 <= q n <= q 500 ,000, 1 <= q q <= q 500 ,000 ) -- the number of vertices in the tree and the number of queries, respectively. The (i - 1) -th of the following n - 1 lines contains two integers p_i and w_i ( 1 <= q p_i < i, 1 <= q w_i <= q 10^9 ), denoting an edge between vertices p_i and i with the weight w_i . It's guaranteed that the given edges form a tree and the vertices are enumerated in the Eulerian traversal order and that the vertex with index 1 is not a leaf. The next q lines describe the queries. Each of them contains three integers v_i , l_i , r_i ( 1 <= q v_i <= q n, 1 <= q l_i <= q r_i <= q n ), describing the parameters of the query. It is guaranteed that t"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
50623359 |
Lagoon_ |
F |
March 1, 2019, 3:57 a.m. |
OK |
GNU C++11 |
TESTS |
38 |
717 |
286515200 |
|
2600 |
50623390 |
Lagoon_ |
F |
March 1, 2019, 3:59 a.m. |
OK |
GNU C++11 |
TESTS |
38 |
732 |
286515200 |
|
2600 |
49818749 |
SovietPower |
F |
Feb. 12, 2019, 7:33 a.m. |
OK |
GNU C++11 |
TESTS |
38 |
733 |
146227200 |
|
2600 |
49848850 |
Eric_hooo |
F |
Feb. 13, 2019, 1:19 a.m. |
OK |
GNU C++11 |
TESTS |
38 |
748 |
164044800 |
|
2600 |
49627230 |
Eric_hooo |
F |
Feb. 8, 2019, 12:36 p.m. |
OK |
GNU C++11 |
TESTS |
38 |
748 |
164044800 |
|
2600 |
50626732 |
luogu_bot3 |
F |
March 1, 2019, 6:32 a.m. |
OK |
GNU C++11 |
TESTS |
38 |
779 |
126259200 |
|
2600 |
49602445 |
1919810 |
F |
Feb. 7, 2019, 5:49 p.m. |
OK |
GNU C++11 |
TESTS |
38 |
779 |
230912000 |
|
2600 |
50626706 |
luogu_bot3 |
F |
March 1, 2019, 6:31 a.m. |
OK |
GNU C++11 |
TESTS |
38 |
780 |
126259200 |
|
2600 |
52559593 |
luogu_bot2 |
F |
April 10, 2019, 9:36 a.m. |
OK |
GNU C++11 |
TESTS |
38 |
795 |
126259200 |
|
2600 |
49928433 |
hankeke |
F |
Feb. 15, 2019, 2:05 a.m. |
OK |
GNU C++11 |
TESTS |
38 |
795 |
198041600 |
|
2600 |
49599958 |
tokitsukaze |
F |
Feb. 7, 2019, 4:48 p.m. |
OK |
GNU C++14 |
TESTS |
38 |
873 |
141619200 |
|
2600 |
49645908 |
paulzrm |
F |
Feb. 9, 2019, 4:19 a.m. |
OK |
GNU C++14 |
TESTS |
38 |
1107 |
108441600 |
|
2600 |
49692496 |
Rabbittank |
F |
Feb. 10, 2019, 12:03 p.m. |
OK |
GNU C++14 |
TESTS |
38 |
1153 |
107417600 |
|
2600 |
49816083 |
amrutha01 |
F |
Feb. 12, 2019, 5:59 a.m. |
OK |
GNU C++14 |
TESTS |
38 |
1154 |
107622400 |
|
2600 |
49645797 |
luogu_bot5 |
F |
Feb. 9, 2019, 4:13 a.m. |
OK |
GNU C++14 |
TESTS |
38 |
1154 |
107622400 |
|
2600 |
49593475 |
natsugiri |
F |
Feb. 7, 2019, 3:18 p.m. |
OK |
GNU C++14 |
TESTS |
38 |
1200 |
64102400 |
|
2600 |
49653856 |
KeyID |
F |
Feb. 9, 2019, 8:55 a.m. |
OK |
GNU C++14 |
TESTS |
38 |
1216 |
108236800 |
|
2600 |
63242866 |
vjudge4 |
F |
Oct. 23, 2019, 1:54 p.m. |
OK |
GNU C++14 |
TESTS |
38 |
1247 |
156160000 |
|
2600 |
49839699 |
Mlxa |
F |
Feb. 12, 2019, 5:47 p.m. |
OK |
GNU C++14 |
TESTS |
38 |
1247 |
467353600 |
|
2600 |
49619627 |
Stupid_cdd |
F |
Feb. 8, 2019, 8:35 a.m. |
OK |
GNU C++14 |
TESTS |
38 |
1262 |
273612800 |
|
2600 |
50621925 |
CMXRYNP |
F |
March 1, 2019, 2:34 a.m. |
OK |
GNU C++17 |
TESTS |
38 |
858 |
129126400 |
|
2600 |
49589965 |
MrDindows |
F |
Feb. 7, 2019, 3:02 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
1060 |
97382400 |
|
2600 |
49987483 |
zhaimingshuzms |
F |
Feb. 16, 2019, 11:13 a.m. |
OK |
GNU C++17 |
TESTS |
38 |
1075 |
86528000 |
|
2600 |
49623075 |
alexey_kuldoshin |
F |
Feb. 8, 2019, 10:25 a.m. |
OK |
GNU C++17 |
TESTS |
38 |
1107 |
83968000 |
|
2600 |
49645921 |
chandu9100 |
F |
Feb. 9, 2019, 4:20 a.m. |
OK |
GNU C++17 |
TESTS |
38 |
1138 |
108646400 |
|
2600 |
49645910 |
paulzrm |
F |
Feb. 9, 2019, 4:19 a.m. |
OK |
GNU C++17 |
TESTS |
38 |
1138 |
108646400 |
|
2600 |
49623048 |
rickytheta |
F |
Feb. 8, 2019, 10:25 a.m. |
OK |
GNU C++17 |
TESTS |
38 |
1231 |
46489600 |
|
2600 |
49659835 |
ILoveU3000 |
F |
Feb. 9, 2019, 11:52 a.m. |
OK |
GNU C++17 |
TESTS |
38 |
1278 |
146329600 |
|
2600 |
49622110 |
rickytheta |
F |
Feb. 8, 2019, 9:57 a.m. |
OK |
GNU C++17 |
TESTS |
38 |
1294 |
56524800 |
|
2600 |
49661537 |
luogu_bot4 |
F |
Feb. 9, 2019, 12:38 p.m. |
OK |
GNU C++17 |
TESTS |
38 |
1294 |
202547200 |
|
2600 |
49587987 |
uwi |
F |
Feb. 7, 2019, 2:52 p.m. |
OK |
Java 8 |
TESTS |
38 |
1543 |
119296000 |
|
2600 |
49587210 |
mmaxio |
F |
Feb. 7, 2019, 2:49 p.m. |
OK |
Java 8 |
TESTS |
38 |
1684 |
121548800 |
|
2600 |
49933955 |
vivekiitian |
F |
Feb. 15, 2019, 6:17 a.m. |
OK |
Java 8 |
TESTS |
38 |
2043 |
214323200 |
|
2600 |
49953608 |
vivekiitian |
F |
Feb. 15, 2019, 3:02 p.m. |
OK |
Java 8 |
TESTS |
38 |
2043 |
214323200 |
|
2600 |
51564502 |
burning_code |
F |
March 20, 2019, 9:12 a.m. |
OK |
Java 8 |
TESTS |
38 |
2059 |
214323200 |
|
2600 |
51563125 |
burning_code |
F |
March 20, 2019, 8:42 a.m. |
OK |
Java 8 |
TESTS |
38 |
2074 |
214323200 |
|
2600 |
51562060 |
burning_code |
F |
March 20, 2019, 8:19 a.m. |
OK |
Java 8 |
TESTS |
38 |
2074 |
214323200 |
|
2600 |
51564397 |
burning_code |
F |
March 20, 2019, 9:09 a.m. |
OK |
Java 8 |
TESTS |
38 |
2152 |
214323200 |
|
2600 |
49613785 |
aman28rwt |
F |
Feb. 8, 2019, 4:26 a.m. |
OK |
Java 8 |
TESTS |
38 |
2183 |
246374400 |
|
2600 |
51584485 |
burning_code |
F |
March 20, 2019, 3:45 p.m. |
OK |
Java 8 |
TESTS |
38 |
2262 |
346521600 |
|
2600 |
49682584 |
selpo |
F |
Feb. 10, 2019, 4:14 a.m. |
OK |
Mono C# |
TESTS |
38 |
3119 |
122777600 |
|
2600 |
49682505 |
selpo |
F |
Feb. 10, 2019, 4:07 a.m. |
OK |
Mono C# |
TESTS |
38 |
3290 |
120115200 |
|
2600 |
49617749 |
r57shell |
F |
Feb. 8, 2019, 7:17 a.m. |
OK |
MS C++ |
TESTS |
38 |
1855 |
114483200 |
|
2600 |
49646117 |
dyxx |
F |
Feb. 9, 2019, 4:30 a.m. |
OK |
MS C++ 2017 |
TESTS |
38 |
1887 |
72806400 |
|
2600 |
remove filters
Back to search problems