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 |
|---|---|---|---|---|---|---|
| 1192 | CEOI 2019 day 1 online mirror (unrated, IOI format) | FINISHED | False | 18000 | 212342123 | July 25, 2019, 2:05 p.m. |
Solved |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
|---|---|---|---|---|---|---|
| ( 1539 ) | B | Dynamic Diameter | PROGRAMMING | *special data structures dfs and similar divide and conquer trees |
You are given a weighted undirected tree on (n) vertices and a list of (q) updates. Each update changes the weight of one edge. The task is to output the diameter of the tree after each update. (The distance between two vertices is the sum of the weights on the unique simple path that connects them. The diameter is the largest of all those distances.) The first line contains three space-separated integers (n), (q) and (w) ((2 \leq n \leq 100,000, 1 \leq q \leq 100,000), (1 \leq w \leq 20,000,000,000,000)) – the number of vertices in the tree, the number of updates and the limit on the weights of edges. The vertices are numbered (1) through (n). Next, (n-1) lines describing the initial tree follow. The (i)-th of these lines contains three space-separated integers (a_i), (b_i), (c_i) ((1 \leq a_i, b_i \leq n), (0 \leq c_i < w)) meaning that initially, there is an edge between vertices (a_i) and (b_i) with weight (c_i). It is guaranteed that these (n-1) lines describe a tree. Finally, (q) lines describing queries follow. The (j)-th of these lines contains two space-separated integers (d_j), (e_j) ((0 \leq d_j < n - 1, 0 \leq e_j < w)). These two integers are then transformed according to the following scheme: (d'_j = (d_j + last) \bmod (n - 1)) (e'_j = (e_j + last) \bmod w) Output (q) lines. For each (i), line (i) should contain the diameter of the tree after the (i)-th update. Subtask 1 (11 points): (n,q \leq 100) and (w \leq 10,000) Subtask 2 (13 points): (n,q \leq 5,000) and (w \leq 10,000) Subtask 3 (7 points): (w \leq 10,000) and the edges of the tree are exactly all valid edges of the form (\{1, i\}) (Hence, the tree is a star centered at vertex 1.) Subtask 4 (18 points): (w \leq 10,000), and the edges of the tree are exactly all valid edges of the forms (\{i, 2i\}) and (\{i, 2i+1\}) (Hence, if w |
| E |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 58244625 | z1321317 | B | Aug. 4, 2019, 4:30 a.m. | OK | GNU C++11 | TESTS | 102 | 296 | 37171200 | ||
| 60965809 | luogu_bot3 | B | Sept. 21, 2019, 6:58 a.m. | OK | GNU C++11 | TESTS | 102 | 296 | 48537600 | ||
| 58219814 | z1321317 | B | Aug. 3, 2019, 12:10 p.m. | OK | GNU C++11 | TESTS | 102 | 311 | 37171200 | ||
| 58219654 | z1321317 | B | Aug. 3, 2019, 12:06 p.m. | OK | GNU C++11 | TESTS | 102 | 311 | 37171200 | ||
| 60749687 | vjudge3 | B | Sept. 18, 2019, 5:21 a.m. | OK | GNU C++11 | TESTS | 102 | 312 | 58265600 | ||
| 64467136 | foreverlasting | B | Nov. 7, 2019, 12:02 p.m. | OK | GNU C++11 | TESTS | 102 | 342 | 55296000 | ||
| 64344792 | Rikuki | B | Nov. 6, 2019, 5:35 a.m. | OK | GNU C++11 | TESTS | 102 | 342 | 61542400 | ||
| 62422201 | ZcyRay | B | Oct. 12, 2019, 1:17 p.m. | OK | GNU C++11 | TESTS | 102 | 343 | 51712000 | ||
| 60832567 | function2 | B | Sept. 19, 2019, 7:35 a.m. | OK | GNU C++11 | TESTS | 102 | 343 | 55705600 | ||
| 62352751 | Abraham_Wu | B | Oct. 11, 2019, 9:54 a.m. | OK | GNU C++11 | TESTS | 102 | 343 | 56115200 | ||
| 62336953 | xzt_2 | B | Oct. 11, 2019, 2:14 a.m. | OK | GNU C++14 | TESTS | 102 | 343 | 63283200 | ||
| 57827251 | NoLongerRed | B | July 27, 2019, 4 a.m. | OK | GNU C++14 | TESTS | 102 | 374 | 35635200 | ||
| 64362971 | Minamoto | B | Nov. 6, 2019, 12:14 p.m. | OK | GNU C++14 | TESTS | 102 | 405 | 151040000 | ||
| 60749189 | 1470519347 | B | Sept. 18, 2019, 4:54 a.m. | OK | GNU C++14 | TESTS | 102 | 421 | 49254400 | ||
| 67651127 | briansu | B | Dec. 26, 2019, 12:10 p.m. | OK | GNU C++14 | TESTS | 102 | 436 | 48025600 | ||
| 60891819 | mchobby | B | Sept. 19, 2019, 5:17 p.m. | OK | GNU C++14 | TESTS | 102 | 452 | 92160000 | ||
| 60684920 | beginend | B | Sept. 16, 2019, 3:04 p.m. | OK | GNU C++14 | TESTS | 102 | 467 | 49254400 | ||
| 57971652 | atoiz | B | July 30, 2019, 6:11 a.m. | OK | GNU C++14 | TESTS | 102 | 468 | 57958400 | ||
| 57962964 | lolicon234 | B | July 30, 2019, 12:55 a.m. | OK | GNU C++14 | TESTS | 102 | 468 | 60006400 | ||
| 57962786 | _user090203 | B | July 30, 2019, 12:48 a.m. | OK | GNU C++14 | TESTS | 102 | 468 | 60006400 | ||
| 58203743 | Elegia | B | Aug. 3, 2019, 5:58 a.m. | OK | GNU C++17 | TESTS | 102 | 327 | 64000000 | ||
| 57753830 | Benq | B | July 25, 2019, 3:36 p.m. | OK | GNU C++17 | TESTS | 102 | 405 | 40755200 | ||
| 57828921 | briansu | B | July 27, 2019, 5:11 a.m. | OK | GNU C++17 | TESTS | 102 | 436 | 62156800 | ||
| 57760979 | dragonslayerintraining | B | July 25, 2019, 6 p.m. | OK | GNU C++17 | TESTS | 102 | 452 | 29286400 | ||
| 62064207 | KKJYOvO | B | Oct. 7, 2019, 2:38 p.m. | OK | GNU C++17 | TESTS | 102 | 452 | 56934400 | ||
| 57829411 | briansu | B | July 27, 2019, 5:28 a.m. | OK | GNU C++17 | TESTS | 102 | 452 | 60518400 | ||
| 57780324 | imeimi | B | July 26, 2019, 5:42 a.m. | OK | GNU C++17 | TESTS | 102 | 483 | 37888000 | ||
| 61348790 | DoubleHappy | B | Sept. 27, 2019, 6:50 a.m. | OK | GNU C++17 | TESTS | 102 | 483 | 85094400 | ||
| 59131185 | Roundgod | B | Aug. 20, 2019, 11:03 a.m. | OK | GNU C++17 | TESTS | 102 | 499 | 54067200 | ||
| 63348244 | Stolf | B | Oct. 24, 2019, 8:17 p.m. | OK | GNU C++17 | TESTS | 102 | 499 | 300339200 | ||
| 57824297 | Tlatoani | B | July 27, 2019, 2 a.m. | OK | Kotlin | TESTS | 102 | 2511 | 56115200 | ||
| 57895118 | TOXait | B | July 28, 2019, 1:15 p.m. | OK | MS C++ 2017 | TESTS | 102 | 1388 | 51609600 |
Back to search problems