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 |
---|---|---|---|---|---|---|
1101 | Educational Codeforces Round 58 (Rated for Div. 2) | FINISHED | False | 7200 | 184605899 | Jan. 11, 2019, 2:35 p.m. |
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
---|---|---|---|---|---|---|
( 4732 ) | D | GCD Counting | PROGRAMMING | data structures dfs and similar dp number theory trees | 2000 |
B"You are given a tree consisting of n vertices. A number is written on each vertex; the number on vertex i is equal to a_i . Let's denote the function g(x, y) as the greatest common divisor of the numbers written on the vertices belonging to the simple path from vertex x to vertex y (including these two vertices). Also let's denote dist(x, y) as the number of vertices on the simple path between vertices x and y , including the endpoints. dist(x, x) = 1 for every vertex x . Your task is calculate the maximum value of dist(x, y) among such pairs of vertices that g(x, y) > 1 . The first line contains one integer n -- the number of vertices (1 <= n <= 2 cdot 10^5) . The second line contains n integers a_1 , a_2 , ..., a_n (1 <= a_i <= 2 cdot 10^5) -- the numbers written on vertices. Then n - 1 lines follow, each containing two integers x and y (1 <= x, y <= n, x ne y) denoting an edge connecting vertex x with vertex y . It is guaranteed that these edges form a tree. If there is no pair of vertices x, y such that g(x, y) > 1 , print 0 . Otherwise print the maximum value of dist(x, y) among such pairs. "... |
64483 |
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
---|---|---|---|---|---|---|---|---|---|---|---|
48455866 | hector_ | D | Jan. 16, 2019, 12:38 p.m. | OK | Clang++17 Diagnostics | TESTS | 27 | 2339 | 74137600 | 2000 | |
48462244 | hector_ | D | Jan. 16, 2019, 3:17 p.m. | OK | Clang++17 Diagnostics | TESTS | 27 | 4321 | 58572800 | 2000 | |
52219094 | sansen | D | April 2, 2019, 5:19 a.m. | OK | GNU C11 | TESTS | 27 | 187 | 8806400 | 2000 | |
48636089 | namratha_253 | D | Jan. 20, 2019, 1:56 p.m. | OK | GNU C11 | TESTS | 27 | 358 | 117043200 | 2000 | |
58152423 | Sanapri | D | Aug. 2, 2019, 3:24 a.m. | OK | GNU C++11 | TESTS | 27 | 93 | 22016000 | 2000 | |
48480883 | luogu_bot5 | D | Jan. 17, 2019, 6:01 a.m. | OK | GNU C++11 | TESTS | 27 | 93 | 22732800 | 2000 | |
48484687 | skyping | D | Jan. 17, 2019, 7:50 a.m. | OK | GNU C++11 | TESTS | 27 | 93 | 22732800 | 2000 | |
48654284 | ReaLNero1 | D | Jan. 21, 2019, 1:27 a.m. | OK | GNU C++11 | TESTS | 27 | 93 | 22732800 | 2000 | |
61087491 | luogu_bot4 | D | Sept. 22, 2019, 7 p.m. | OK | GNU C++11 | TESTS | 27 | 108 | 11059200 | 2000 | |
61087455 | luogu_bot2 | D | Sept. 22, 2019, 7 p.m. | OK | GNU C++11 | TESTS | 27 | 108 | 11059200 | 2000 | |
61070589 | ctz45562 | D | Sept. 22, 2019, 12:36 p.m. | OK | GNU C++11 | TESTS | 27 | 109 | 11059200 | 2000 | |
48484619 | skyping | D | Jan. 17, 2019, 7:48 a.m. | OK | GNU C++11 | TESTS | 27 | 109 | 22732800 | 2000 | |
48324904 | SGColin | D | Jan. 13, 2019, 11:20 a.m. | OK | GNU C++11 | TESTS | 27 | 124 | 16793600 | 2000 | |
48324918 | COLINGAO | D | Jan. 13, 2019, 11:21 a.m. | OK | GNU C++11 | TESTS | 27 | 124 | 16793600 | 2000 | |
48272365 | deja-vu | D | Jan. 12, 2019, 3:19 a.m. | OK | GNU C++14 | TESTS | 23 | 233 | 8601600 | 2000 | |
48272300 | deja-vu | D | Jan. 12, 2019, 3:16 a.m. | OK | GNU C++14 | TESTS | 23 | 233 | 9216000 | 2000 | |
48272186 | deja-vu | D | Jan. 12, 2019, 3:09 a.m. | OK | GNU C++14 | TESTS | 23 | 233 | 20684800 | 2000 | |
63415159 | 2683331518 | D | Oct. 26, 2019, 3:39 a.m. | OK | GNU C++14 | TESTS | 27 | 233 | 24883200 | 2000 | |
48274609 | rasalghul | D | Jan. 12, 2019, 4:58 a.m. | OK | GNU C++14 | TESTS | 23 | 249 | 7884800 | 2000 | |
48288078 | deja-vu | D | Jan. 12, 2019, 11:34 a.m. | OK | GNU C++14 | TESTS | 23 | 249 | 8601600 | 2000 | |
49291507 | coolreshab | D | Jan. 31, 2019, 7:35 p.m. | OK | GNU C++14 | TESTS | 27 | 249 | 17817600 | 2000 | |
48272166 | deja-vu | D | Jan. 12, 2019, 3:08 a.m. | OK | GNU C++14 | TESTS | 23 | 249 | 20582400 | 2000 | |
49785271 | Tosic | D | Feb. 11, 2019, 7:31 p.m. | OK | GNU C++14 | TESTS | 27 | 249 | 20992000 | 2000 | |
48315829 | BanFcc | D | Jan. 13, 2019, 6:30 a.m. | OK | GNU C++14 | TESTS | 26 | 249 | 21299200 | 2000 | |
66784054 | shurongwang | D | Dec. 13, 2019, 1:02 p.m. | OK | GNU C++17 | TESTS | 27 | 264 | 18739200 | 2000 | |
48326783 | kakashi007 | D | Jan. 13, 2019, 12:17 p.m. | OK | GNU C++17 | TESTS | 27 | 264 | 20480000 | 2000 | |
48276871 | Firastic | D | Jan. 12, 2019, 6:09 a.m. | OK | GNU C++17 | TESTS | 23 | 265 | 8396800 | 2000 | |
48303876 | duckladydinh | D | Jan. 12, 2019, 6:29 p.m. | OK | GNU C++17 | TESTS | 24 | 265 | 17305600 | 2000 | |
48318659 | libra9z | D | Jan. 13, 2019, 8:02 a.m. | OK | GNU C++17 | TESTS | 27 | 265 | 19046400 | 2000 | |
48310740 | The_Blitz | D | Jan. 13, 2019, 1:17 a.m. | OK | GNU C++17 | TESTS | 24 | 265 | 21401600 | 2000 | |
61960360 | disposrestfuIly | D | Oct. 6, 2019, 7:16 a.m. | OK | GNU C++17 | TESTS | 27 | 265 | 53760000 | 2000 | |
65734998 | Magicdog_Jo | D | Nov. 26, 2019, 7:19 a.m. | OK | GNU C++17 | TESTS | 27 | 280 | 5017600 | 2000 | |
48487775 | wladw | D | Jan. 17, 2019, 9:11 a.m. | OK | GNU C++17 | TESTS | 27 | 280 | 9011200 | 2000 | |
66785828 | shurongwang | D | Dec. 13, 2019, 1:37 p.m. | OK | GNU C++17 | TESTS | 27 | 280 | 18841600 | 2000 | |
49851668 | aman28rwt | D | Feb. 13, 2019, 4:18 a.m. | OK | Java 8 | TESTS | 27 | 373 | 11264000 | 2000 | |
48301354 | Taran_1407 | D | Jan. 12, 2019, 5:06 p.m. | OK | Java 8 | TESTS | 23 | 592 | 89190400 | 2000 | |
48271811 | poiuytrewq | D | Jan. 12, 2019, 2:48 a.m. | OK | Java 8 | TESTS | 23 | 717 | 57036800 | 2000 | |
48473452 | Ahmad | D | Jan. 16, 2019, 11:55 p.m. | OK | Java 8 | TESTS | 27 | 779 | 74342400 | 2000 | |
49386261 | vjudge5 | D | Feb. 3, 2019, 7:04 a.m. | OK | Java 8 | TESTS | 27 | 858 | 38092800 | 2000 | |
69016158 | saurabhs1206 | D | Jan. 18, 2020, 5:20 a.m. | OK | Java 8 | TESTS | 27 | 904 | 140390400 | 2000 | |
48464125 | dmitriy0712 | D | Jan. 16, 2019, 4:19 p.m. | OK | Java 8 | TESTS | 27 | 982 | 109363200 | 2000 | |
49935284 | poketred12 | D | Feb. 15, 2019, 7:02 a.m. | OK | Java 8 | TESTS | 27 | 1028 | 61849600 | 2000 | |
57341751 | Ahmed_Diab | D | July 19, 2019, 7:04 p.m. | OK | Java 8 | TESTS | 27 | 1029 | 10956800 | 2000 | |
48607813 | AJ47 | D | Jan. 20, 2019, 11:56 a.m. | OK | Java 8 | TESTS | 27 | 1029 | 142438400 | 2000 | |
64073935 | vjudge4 | D | Nov. 2, 2019, 8:17 a.m. | OK | MS C++ | TESTS | 27 | 358 | 36864000 | 2000 | |
49178105 | vjudge4 | D | Jan. 29, 2019, 10:26 p.m. | OK | MS C++ | TESTS | 27 | 389 | 27033600 | 2000 | |
48425805 | Houbunsha | D | Jan. 15, 2019, 2:52 p.m. | OK | MS C++ | TESTS | 27 | 561 | 23142400 | 2000 | |
50671677 | wjfwjfwjf | D | March 2, 2019, 7:19 a.m. | OK | MS C++ | TESTS | 27 | 1450 | 61644800 | 2000 | |
48303930 | Dru | D | Jan. 12, 2019, 6:31 p.m. | OK | MS C++ | TESTS | 24 | 3634 | 8704000 | 2000 | |
48303684 | Dru | D | Jan. 12, 2019, 6:23 p.m. | OK | MS C++ | TESTS | 24 | 4071 | 3993600 | 2000 | |
48266479 | nik1998 | D | Jan. 11, 2019, 8:37 p.m. | OK | MS C++ | TESTS | 23 | 4133 | 116838400 | 2000 | |
58240211 | Pricolno | D | Aug. 3, 2019, 11:46 p.m. | OK | MS C++ 2017 | TESTS | 27 | 733 | 35123200 | 2000 | |
49953595 | nomiku99 | D | Feb. 15, 2019, 3:02 p.m. | OK | MS C++ 2017 | TESTS | 27 | 764 | 54476800 | 2000 | |
59095103 | yorky | D | Aug. 19, 2019, 1:58 p.m. | OK | MS C++ 2017 | TESTS | 27 | 1248 | 45670400 | 2000 | |
49073106 | aeremin | D | Jan. 27, 2019, 11:05 p.m. | OK | MS C++ 2017 | TESTS | 27 | 2792 | 107008000 | 2000 | |
50496531 | fillinia | D | Feb. 25, 2019, 3:24 p.m. | OK | PyPy 3 | TESTS | 27 | 2589 | 68403200 | 2000 | |
48448602 | Firepaw | D | Jan. 16, 2019, 8:53 a.m. | OK | PyPy 3 | TESTS | 27 | 2869 | 57036800 | 2000 | |
48605784 | tiantian5 | D | Jan. 20, 2019, 10:48 a.m. | OK | PyPy 3 | TESTS | 27 | 2978 | 99123200 | 2000 | |
48326252 | nik-in-au | D | Jan. 13, 2019, 11:59 a.m. | OK | PyPy 3 | TESTS | 27 | 3135 | 38297600 | 2000 | |
49806402 | Hillmouse | D | Feb. 11, 2019, 8:09 p.m. | OK | Rust | TESTS | 27 | 421 | 31641600 | 2000 | |
48331092 | rustaurance | D | Jan. 13, 2019, 2:28 p.m. | OK | Rust | TESTS | 27 | 529 | 47820800 | 2000 |
Back to search problems