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 |
---|---|---|---|---|---|---|
1210 | Dasha Code Championship - SPb Finals Round (only for onsite-finalists) | FINISHED | False | 9000 | 168296087 | Sept. 22, 2019, 9:05 a.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 3367 ) | C | Kamil and Making a Stream | PROGRAMMING | math number theory trees | 2100 |
B"Kamil likes streaming the competitive programming videos. His MeTube channel has recently reached 100 million subscribers. In order to celebrate this, he posted a video with an interesting problem he couldn't solve yet. Can you help him? You're given a tree -- a connected undirected graph consisting of n vertices connected by n - 1 edges. The tree is rooted at vertex 1 . A vertex u is called an ancestor of v if it lies on the shortest path between the root and v . In particular, a vertex is an ancestor of itself. Each vertex v is assigned its beauty x_v -- a non-negative integer not larger than 10^{12} . This allows us to define the beauty of a path. Let u be an ancestor of v . Then we define the beauty f(u, v) as the greatest common divisor of the beauties of all vertices on the shortest path between u and v . Formally, if u=t_1, t_2, t_3, ... , t_k=v are the vertices on the shortest path between u and v , then f(u, v) = gcd(x_{t_1}, x_{t_2}, ... , x_{t_k}) . Here, gcd denotes the greatest common divisor of a set of numbers. In particular, f(u, u) = gcd(x_u) = x_u . Your task is to find the sum sum_{u text{ is an ancestor of }v} f(u, v). As the result might be too large, please output it modulo 10^9 + 7 . Note that for each y , gcd(0, y) = gcd(y, 0) = y . In particular, gcd(0, 0) = 0 . The first line contains a single integer n ( 2 <= n <= 100 ,000 ) -- the number of vertices in the tree. The following line contains n integers x_1, x_2, ... , x_n ( 0 <= x_i <= 10^{12} ). The value x_v denotes the beauty of vertex v . The following n - 1 lines describe the edges of the tree. Each of them contains two integers a, b ( 1 <= a, b <= n , a neq b ) -- the vertices connected by a single edge. Output the sum of the beauties on all paths "... |
Dasha Code Championship Finals and Mirror Round 588 Editorial |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
63399448 | vjudge2 | C | Oct. 25, 2019, 5:48 p.m. | OK | GNU C++11 | TESTS | 83 | 311 | 120217600 | 2100 | |
61188782 | AutumnKite | C | Sept. 24, 2019, 1:17 a.m. | OK | GNU C++11 | TESTS | 83 | 343 | 252416000 | 2100 | |
64782110 | _ShadowSong | C | Nov. 13, 2019, 7:36 a.m. | OK | GNU C++11 | TESTS | 83 | 389 | 190156800 | 2100 | |
62033418 | nico123 | C | Oct. 7, 2019, 2:24 a.m. | OK | GNU C++11 | TESTS | 83 | 607 | 177766400 | 2100 | |
62032627 | nico123 | C | Oct. 7, 2019, 1:55 a.m. | OK | GNU C++11 | TESTS | 83 | 608 | 177766400 | 2100 | |
61550168 | Adelard | C | Sept. 30, 2019, 12:10 p.m. | OK | GNU C++11 | TESTS | 83 | 639 | 175001600 | 2100 | |
62033445 | nico123 | C | Oct. 7, 2019, 2:25 a.m. | OK | GNU C++11 | TESTS | 83 | 655 | 177766400 | 2100 | |
61886062 | sdibt3 | C | Oct. 5, 2019, 3:32 a.m. | OK | GNU C++11 | TESTS | 83 | 685 | 176844800 | 2100 | |
62328828 | stefan_creasta | C | Oct. 10, 2019, 7:39 p.m. | OK | GNU C++11 | TESTS | 83 | 716 | 177356800 | 2100 | |
64435075 | Dream-chasing_Juvenile | C | Nov. 7, 2019, 12:40 a.m. | OK | GNU C++11 | TESTS | 83 | 1060 | 335872000 | 2100 | |
66659937 | bouncypi | C | Dec. 12, 2019, 3:41 a.m. | OK | GNU C++14 | TESTS | 83 | 342 | 109670400 | 2100 | |
61061266 | pashka | C | Sept. 22, 2019, 9:32 a.m. | OK | GNU C++14 | TESTS | 82 | 358 | 120729600 | 2100 | |
61061762 | cookiedoth | C | Sept. 22, 2019, 9:41 a.m. | OK | GNU C++14 | TESTS | 82 | 374 | 122368000 | 2100 | |
68493254 | TriG0n0metry | C | Jan. 10, 2020, 12:28 p.m. | OK | GNU C++14 | TESTS | 83 | 389 | 191078400 | 2100 | |
61276201 | DoanPhuDuc | C | Sept. 25, 2019, 3:31 p.m. | OK | GNU C++14 | TESTS | 83 | 421 | 37376000 | 2100 | |
61061713 | sava-cska | C | Sept. 22, 2019, 9:40 a.m. | OK | GNU C++14 | TESTS | 82 | 436 | 185446400 | 2100 | |
63626441 | vjudge4 | C | Oct. 28, 2019, 4:04 a.m. | OK | GNU C++14 | TESTS | 83 | 654 | 121958400 | 2100 | |
61435334 | Mint_Dentifrice | C | Sept. 28, 2019, 4:23 p.m. | OK | GNU C++14 | TESTS | 83 | 654 | 174387200 | 2100 | |
61345046 | lightkuriboh | C | Sept. 27, 2019, 3:59 a.m. | OK | GNU C++14 | TESTS | 83 | 655 | 175923200 | 2100 | |
67134007 | boatinw99 | C | Dec. 18, 2019, 2:42 a.m. | OK | GNU C++14 | TESTS | 83 | 670 | 174387200 | 2100 | |
66893481 | toi333 | C | Dec. 14, 2019, 10:34 p.m. | OK | GNU C++17 | TESTS | 83 | 233 | 83660800 | 2100 | |
61061475 | egor_bb | C | Sept. 22, 2019, 9:36 a.m. | OK | GNU C++17 | TESTS | 82 | 327 | 118784000 | 2100 | |
61061347 | aid | C | Sept. 22, 2019, 9:34 a.m. | OK | GNU C++17 | TESTS | 82 | 342 | 143257600 | 2100 | |
61061993 | izban | C | Sept. 22, 2019, 9:45 a.m. | OK | GNU C++17 | TESTS | 82 | 342 | 151244800 | 2100 | |
61061841 | BledDest | C | Sept. 22, 2019, 9:43 a.m. | OK | GNU C++17 | TESTS | 82 | 343 | 117555200 | 2100 | |
61063081 | riadwaw | C | Sept. 22, 2019, 10:06 a.m. | OK | GNU C++17 | TESTS | 82 | 358 | 113459200 | 2100 | |
61066501 | noxwell | C | Sept. 22, 2019, 11:17 a.m. | OK | GNU C++17 | TESTS | 82 | 358 | 119091200 | 2100 | |
61062596 | platypus179 | C | Sept. 22, 2019, 9:57 a.m. | OK | GNU C++17 | TESTS | 82 | 374 | 119091200 | 2100 | |
61063168 | skrydg | C | Sept. 22, 2019, 10:08 a.m. | OK | GNU C++17 | TESTS | 82 | 389 | 185856000 | 2100 | |
67848887 | dinosaurs | C | Dec. 29, 2019, 12:39 a.m. | OK | GNU C++17 | TESTS | 83 | 405 | 251392000 | 2100 | |
61062592 | eatmore | C | Sept. 22, 2019, 9:56 a.m. | OK | Java 8 | TESTS | 82 | 779 | 187801600 | 2100 | |
61061831 | VArtem | C | Sept. 22, 2019, 9:42 a.m. | OK | Java 8 | TESTS | 82 | 2012 | 97484800 | 2100 | |
61061997 | qwerty787788 | C | Sept. 22, 2019, 9:45 a.m. | OK | Java 8 | TESTS | 82 | 2215 | 81715200 | 2100 | |
66978377 | conjecture_xyz | C | Dec. 15, 2019, 3:29 p.m. | OK | PyPy 3 | TESTS | 83 | 3088 | 139673600 | 2100 |
Back to search problems